changeset e8ad97e4fbd0 in modules/purchase_requisition:default
details: 
https://hg.tryton.org/modules/purchase_requisition?cmd=changeset&node=e8ad97e4fbd0
description:
        Provide digits from unit of measure

        issue10677
        review365801002
diffstat:

 purchase.py |  13 ++-----------
 1 files changed, 2 insertions(+), 11 deletions(-)

diffs (44 lines):

diff -r 7907501bc33f -r e8ad97e4fbd0 purchase.py
--- a/purchase.py       Sat Aug 21 09:09:56 2021 +0200
+++ b/purchase.py       Mon Aug 30 00:27:13 2021 +0200
@@ -447,8 +447,8 @@
     description = fields.Text("Description", states=_states, depends=_depends)
     summary = fields.Function(fields.Char('Summary'), 'on_change_with_summary')
     quantity = fields.Float(
-        'Quantity', digits=(16, Eval('unit_digits', 2)), required=True,
-        states=_states, depends=['unit_digits'] + _depends)
+        "Quantity", digits='unit', required=True,
+        states=_states, depends=_depends)
     unit = fields.Many2One(
         'product.uom', 'Unit', ondelete='RESTRICT',
         states={
@@ -456,8 +456,6 @@
             'readonly': _states['readonly'],
             },
         depends=['product'] + _depends)
-    unit_digits = fields.Function(
-        fields.Integer('Unit Digits'), 'on_change_with_unit_digits')
     unit_price = Monetary(
         'Unit Price', currency='currency', digits=price_digits,
         states=_states, depends=_depends)
@@ -519,7 +517,6 @@
         category = self.product.purchase_uom.category
         if not self.unit or self.unit.category != category:
             self.unit = self.product.purchase_uom
-            self.unit_digits = self.product.purchase_uom.digits
 
     @fields.depends('description')
     def on_change_with_summary(self, name=None):
@@ -535,12 +532,6 @@
             amount = self.requisition.currency.round(amount)
         return amount
 
-    @fields.depends('unit')
-    def on_change_with_unit_digits(self, name=None):
-        if self.unit:
-            return self.unit.digits
-        return 2
-
     def get_rec_name(self, name):
         pool = Pool()
         Lang = pool.get('ir.lang')

Reply via email to