mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-20 05:46:34 +00:00
Improve error checking for initial stock creation when creating a new part
- Use @transaction.atomic - Raise proper field errors
This commit is contained in:
@ -117,10 +117,29 @@ function partFields(options={}) {
|
||||
delete fields["default_supplier"];
|
||||
|
||||
if (global_settings.PART_CREATE_INITIAL) {
|
||||
|
||||
fields.initial_stock = {
|
||||
type: 'boolean',
|
||||
label: '{% trans "Create Initial Stock" %}',
|
||||
help_text: '{% trans "Create an initial stock item for this part" %}',
|
||||
group: 'create',
|
||||
};
|
||||
|
||||
fields.initial_stock_quantity = {
|
||||
type: 'decimal',
|
||||
label: '{% trans "Initial Stock Quantity" %}',
|
||||
help_text: '{% trans "Initialize part stock with specified quantity" %}',
|
||||
help_text: '{% trans "Specify initial stock quantity for this part" %}',
|
||||
group: 'create',
|
||||
};
|
||||
|
||||
// TODO - Allow initial location of stock to be specified
|
||||
fields.initial_stock_location = {
|
||||
label: '{% trans "Location" %}',
|
||||
help_text: '{% trans "Select destination stock location" %}',
|
||||
type: 'related field',
|
||||
required: true,
|
||||
api_url: `/api/stock/location/`,
|
||||
model: 'stocklocation',
|
||||
group: 'create',
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user