mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-04 04:30:56 +00:00
Merge branch 'master' of github.com:inventree/InvenTree into bom_items_purchase_price
This commit is contained in:
@ -89,6 +89,15 @@ function setFieldOptions(fieldName, optionList, options={}) {
|
||||
}
|
||||
|
||||
|
||||
function clearFieldOptions(fieldName) {
|
||||
/**
|
||||
* Clear (emtpy) the options list for a particular field
|
||||
*/
|
||||
|
||||
setFieldOptions(fieldName, []);
|
||||
}
|
||||
|
||||
|
||||
function reloadFieldOptions(fieldName, options) {
|
||||
/* Reload the options for a given field,
|
||||
* using an AJAX request.
|
||||
|
@ -1017,6 +1017,11 @@ function loadStockTrackingTable(table, options) {
|
||||
formatter: function(details, row, index, field) {
|
||||
var html = `<table class='table table-condensed' id='tracking-table-${row.pk}'>`;
|
||||
|
||||
if (!details) {
|
||||
html += '</table>';
|
||||
return html;
|
||||
}
|
||||
|
||||
// Location information
|
||||
if (details.location) {
|
||||
|
||||
@ -1218,6 +1223,17 @@ function createNewStockItem(options) {
|
||||
field: 'part',
|
||||
action: function(value) {
|
||||
|
||||
if (!value) {
|
||||
// No part chosen
|
||||
|
||||
clearFieldOptions('supplier_part');
|
||||
enableField('serial_numbers', false);
|
||||
enableField('purchase_price_0', false);
|
||||
enableField('purchase_price_1', false);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Reload options for supplier part
|
||||
reloadFieldOptions(
|
||||
'supplier_part',
|
||||
@ -1243,6 +1259,9 @@ function createNewStockItem(options) {
|
||||
enableField('serial_numbers', response.trackable);
|
||||
clearField('serial_numbers');
|
||||
|
||||
enableField('purchase_price_0', response.purchaseable);
|
||||
enableField('purchase_price_1', response.purchaseable);
|
||||
|
||||
// Populate the expiry date
|
||||
if (response.default_expiry <= 0) {
|
||||
// No expiry date
|
||||
|
Reference in New Issue
Block a user