Use API forms for creating and editing BomItem objects

This commit is contained in:
Oliver Walters committed 2021-08-04 17:25:51 +10:00
1 parent 96a79e557b
commit 75a1be0284
5 files changed
+43 -188

No files matched your search

+28 -7
View File
@@ -8,6 +8,26 @@
*/
function bomItemFields() {
return {
part: {
hidden: true,
},
sub_part: {
},
quantity: {},
reference: {},
overage: {},
note: {},
allow_variants: {},
inherited: {},
optional: {},
};
}
function reloadBomTable(table, options) {
table.bootstrapTable('refresh');
@@ -528,14 +548,15 @@ function loadBomTable(table, options) {
var pk = $(this).attr('pk');
var url = `/part/bom/${pk}/edit/`;
launchModalForm(
url,
{
success: function() {
reloadBomTable(table);
}
var fields = bomItemFields();
constructForm(`/api/bom/${pk}/`, {
fields: fields,
title: '{% trans "Edit BOM Item" %}',
onSuccess: function() {
reloadBomTable(table);
}
);
});
});
table.on('click', '.bom-validate-button', function() {