2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-09 07:00:56 +00:00

Create SupplierPart directly from PurchaseOrderLineItem dialog (#3361)

* Move JS code from html to external .js file

* Add secondary dialog for creating a new SupplierPart from the PurchaseOrderLineItem dialog

* JS linting
This commit is contained in:
Oliver
2022-07-20 12:53:31 +10:00
committed by GitHub
parent e383d6e955
commit afcd60b387
4 changed files with 80 additions and 20 deletions

View File

@ -102,10 +102,14 @@ function editManufacturerPart(part, options={}) {
}
function supplierPartFields() {
function supplierPartFields(options={}) {
return {
part: {},
var fields = {
part: {
filters: {
purchaseable: true,
}
},
manufacturer_part: {
filters: {
part_detail: true,
@ -128,6 +132,12 @@ function supplierPartFields() {
icon: 'fa-box',
}
};
if (options.part) {
fields.manufacturer_part.filters.part = options.part;
}
return fields;
}
/*
@ -135,10 +145,11 @@ function supplierPartFields() {
*/
function createSupplierPart(options={}) {
var fields = supplierPartFields();
var fields = supplierPartFields({
part: options.part,
});
if (options.part) {
fields.manufacturer_part.filters.part = options.part;
fields.part.hidden = true;
fields.part.value = options.part;
}