mirror of
https://github.com/inventree/InvenTree.git
synced 2025-08-07 20:32:12 +00:00
Use API to mark part as active/inactive
This commit is contained in:
@@ -53,6 +53,7 @@ class PartSerializer(serializers.ModelSerializer):
|
||||
|
||||
class Meta:
|
||||
model = Part
|
||||
partial = True
|
||||
fields = [
|
||||
'pk',
|
||||
'url', # Link to the part detail page
|
||||
|
@@ -146,6 +146,33 @@
|
||||
});
|
||||
});
|
||||
|
||||
$('#activate-part').click(function() {
|
||||
inventreeUpdate(
|
||||
"{% url 'api-part-detail' part.id %}",
|
||||
{
|
||||
active: true,
|
||||
},
|
||||
{
|
||||
method: 'PATCH',
|
||||
reloadOnSuccess: true,
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
$('#deactivate-part').click(function() {
|
||||
inventreeUpdate(
|
||||
"{% url 'api-part-detail' part.id %}",
|
||||
{
|
||||
active: false,
|
||||
},
|
||||
{
|
||||
method: 'PATCH',
|
||||
reloadOnSuccess: true,
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
$('#delete-part').click(function() {
|
||||
launchDeleteForm(
|
||||
"{% url 'part-delete' part.id %}",
|
||||
|
Reference in New Issue
Block a user