mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +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
|
||||
validators = kwargs.get('validators', [])
|
||||
|
||||
allow_negative = kwargs.pop('allow_negative', False)
|
||||
|
||||
# If no validators are provided, add some "standard" ones
|
||||
if len(validators) == 0:
|
||||
validators.append(
|
||||
MinMoneyValidator(0),
|
||||
)
|
||||
|
||||
if not allow_negative:
|
||||
validators.append(
|
||||
MinMoneyValidator(0),
|
||||
)
|
||||
|
||||
kwargs['validators'] = validators
|
||||
|
||||
|
@ -957,6 +957,7 @@ class OrderExtraLine(OrderLineItem):
|
||||
max_digits=19,
|
||||
decimal_places=4,
|
||||
null=True, blank=True,
|
||||
allow_negative=True,
|
||||
verbose_name=_('Price'),
|
||||
help_text=_('Unit price'),
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user