Provide digits from unit of measure
issue10677 review365801002
This commit is contained in:
1 parent
3024976a6d
commit
b29a0c4e36
1 file changed
+1
-10
@@ -128,15 +128,12 @@ class Promotion(
|
||||
},
|
||||
depends=['amount'])
|
||||
|
||||
quantity = fields.Float('Quantity', digits=(16, Eval('unit_digits', 2)),
|
||||
depends=['unit_digits'])
|
||||
quantity = fields.Float('Quantity', digits='unit')
|
||||
unit = fields.Many2One('product.uom', 'Unit',
|
||||
states={
|
||||
'required': Bool(Eval('quantity', 0)),
|
||||
},
|
||||
depends=['quantity'])
|
||||
unit_digits = fields.Function(fields.Integer('Unit Digits'),
|
||||
'on_change_with_unit_digits')
|
||||
products = fields.Many2Many(
|
||||
'sale.promotion-product.product', 'promotion', 'product', "Products",
|
||||
context={
|
||||
@@ -162,12 +159,6 @@ class Promotion(
|
||||
def default_untaxed_amount(cls):
|
||||
return False
|
||||
|
||||
@fields.depends('unit')
|
||||
def on_change_with_unit_digits(self, name=None):
|
||||
if self.unit:
|
||||
return self.unit.digits
|
||||
return 2
|
||||
|
||||
@classmethod
|
||||
def validate(cls, promotions):
|
||||
super().validate(promotions)
|
||||
|
||||
Reference in new issue
Block a user