Add secondary field options for "Create Supplier Part" form

- Supplier
- Manufacturer Part
This commit is contained in:
Oliver Walters 2021-08-07 23:42:42 +10:00
parent b960ce839a
commit 94c1ed882f

View File

@ -72,7 +72,7 @@ function supplierPartFields() {
filters: { filters: {
part_detail: true, part_detail: true,
manufacturer_detail: true, manufacturer_detail: true,
} },
}, },
description: {}, description: {},
link: { link: {
@ -108,6 +108,33 @@ function createSupplierPart(options={}) {
fields.manufacturer_part.value = options.manufacturer_part; fields.manufacturer_part.value = options.manufacturer_part;
} }
// Add a secondary modal for the supplier
fields.supplier.secondary = {
title: '{% trans "Add Supplier" %}',
fields: function(data) {
var company_fields = companyFormFields();
company_fields.is_supplier.value = true;
return company_fields;
}
};
// Add a secondary modal for the manufacturer part
fields.manufacturer_part.secondary = {
title: '{% trans "Add Manufacturer Part" %}',
fields: function(data) {
var mp_fields = manufacturerPartFields();
if (data.part) {
mp_fields.part.value = data.part;
mp_fields.part.hidden = true;
}
return mp_fields;
}
};
constructForm('{% url "api-supplier-part-list" %}', { constructForm('{% url "api-supplier-part-list" %}', {
fields: fields, fields: fields,
method: 'POST', method: 'POST',