mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge pull request #2408 from SchrodingersGat/initial-stock-when-duplicating
Add option for creating initial stock quantity when duplicating a part
This commit is contained in:
commit
96c1f74cd8
@ -153,12 +153,7 @@ function partFields(options={}) {
|
|||||||
delete fields['default_expiry'];
|
delete fields['default_expiry'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Additional fields when "creating" a new part
|
if (options.create || options.duplicate) {
|
||||||
if (options.create) {
|
|
||||||
|
|
||||||
// No supplier parts available yet
|
|
||||||
delete fields['default_supplier'];
|
|
||||||
|
|
||||||
if (global_settings.PART_CREATE_INITIAL) {
|
if (global_settings.PART_CREATE_INITIAL) {
|
||||||
|
|
||||||
fields.initial_stock = {
|
fields.initial_stock = {
|
||||||
@ -187,6 +182,13 @@ function partFields(options={}) {
|
|||||||
group: 'create',
|
group: 'create',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Additional fields when "creating" a new part
|
||||||
|
if (options.create) {
|
||||||
|
|
||||||
|
// No supplier parts available yet
|
||||||
|
delete fields['default_supplier'];
|
||||||
|
|
||||||
fields.copy_category_parameters = {
|
fields.copy_category_parameters = {
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
@ -349,6 +351,10 @@ function duplicatePart(pk, options={}) {
|
|||||||
duplicate: pk,
|
duplicate: pk,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (fields.initial_stock_location) {
|
||||||
|
fields.initial_stock_location.value = data.default_location;
|
||||||
|
}
|
||||||
|
|
||||||
// Remove "default_supplier" field
|
// Remove "default_supplier" field
|
||||||
delete fields['default_supplier'];
|
delete fields['default_supplier'];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user