Merge pull request #1923 from SchrodingersGat/secondary-modals

Secondary modals
This commit is contained in:
Oliver 2021-08-08 01:13:42 +10:00 committed by GitHub
commit 681f285aa3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 3 deletions

View File

@ -1240,7 +1240,9 @@ function setRelatedFieldData(name, data, options) {
}
function initializeChoiceField(name, field, options) {
function initializeChoiceField(field, fields, options) {
var name = field.name;
var select = $(options.modal).find(`#id_${name}`);

View File

@ -13,6 +13,16 @@ function createSalesOrder(options={}) {
},
customer: {
value: options.customer,
secondary: {
title: '{% trans "Add Customer" %}',
fields: function(data) {
var fields = companyFormFields();
fields.is_customer.value = true;
return fields;
}
}
},
customer_reference: {},
description: {},
@ -44,6 +54,16 @@ function createPurchaseOrder(options={}) {
},
supplier: {
value: options.supplier,
secondary: {
title: '{% trans "Add Supplier" %}',
fields: function(data) {
var fields = companyFormFields();
fields.is_supplier.value = true;
return fields;
}
}
},
supplier_reference: {},
description: {},

View File

@ -17,7 +17,16 @@ function yesNoLabel(value) {
function partFields(options={}) {
var fields = {
category: {},
category: {
secondary: {
title: '{% trans "Add Part Category" %}',
fields: function(data) {
var fields = categoryFields();
return fields;
}
}
},
name: {},
IPN: {},
revision: {},
@ -30,7 +39,8 @@ function partFields(options={}) {
link: {
icon: 'fa-link',
},
default_location: {},
default_location: {
},
default_supplier: {},
default_expiry: {
icon: 'fa-calendar-alt',

View File

@ -2,6 +2,18 @@
{% load inventree_extras %}
{% load status_codes %}
function locationFields() {
return {
parent: {
help_text: '{% trans "Parent stock location" %}',
},
name: {},
description: {},
};
}
/* Stock API functions
* Requires api.js to be loaded first
*/