mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge pull request #1593 from SchrodingersGat/hide-purchase-price
Disable "purchase price" field for non-purchaseable parts
This commit is contained in:
commit
56fd8132c7
@ -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.
|
||||
|
@ -1218,6 +1218,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 +1254,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
|
||||
|
Loading…
Reference in New Issue
Block a user