mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 20:16:44 +00:00
Allow negative currency values for "extra" line items (#3311)
This commit is contained in:
parent
8f10bbb7e1
commit
78264868e1
@ -63,10 +63,15 @@ class InvenTreeModelMoneyField(ModelMoneyField):
|
|||||||
# Set a minimum value validator
|
# Set a minimum value validator
|
||||||
validators = kwargs.get('validators', [])
|
validators = kwargs.get('validators', [])
|
||||||
|
|
||||||
|
allow_negative = kwargs.pop('allow_negative', False)
|
||||||
|
|
||||||
|
# If no validators are provided, add some "standard" ones
|
||||||
if len(validators) == 0:
|
if len(validators) == 0:
|
||||||
validators.append(
|
|
||||||
MinMoneyValidator(0),
|
if not allow_negative:
|
||||||
)
|
validators.append(
|
||||||
|
MinMoneyValidator(0),
|
||||||
|
)
|
||||||
|
|
||||||
kwargs['validators'] = validators
|
kwargs['validators'] = validators
|
||||||
|
|
||||||
|
@ -957,6 +957,7 @@ class OrderExtraLine(OrderLineItem):
|
|||||||
max_digits=19,
|
max_digits=19,
|
||||||
decimal_places=4,
|
decimal_places=4,
|
||||||
null=True, blank=True,
|
null=True, blank=True,
|
||||||
|
allow_negative=True,
|
||||||
verbose_name=_('Price'),
|
verbose_name=_('Price'),
|
||||||
help_text=_('Unit price'),
|
help_text=_('Unit price'),
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user