From c84eb3700314678f44ec91d9cfcb7e8289569aae Mon Sep 17 00:00:00 2001 From: Karla Stenger Date: Mon, 11 Jan 2016 10:29:44 -0300 Subject: [PATCH] Change Uom.round into an instance method. issue4423 review16871002 --- purchase.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/purchase.py b/purchase.py index ee293df065..37a24383ae 100644 --- a/purchase.py +++ b/purchase.py @@ -1217,8 +1217,10 @@ class PurchaseLine(ModelSQL, ModelView): quantity = (self._get_invoice_line_quantity(invoice_type) - self._get_invoiced_quantity(invoice_type)) - rounding = self.unit.rounding if self.unit else 0.01 - invoice_line.quantity = Uom.round(quantity, rounding) + if self.unit: + quantity = self.unit.round(quantity) + invoice_line.quantity = quantity + if invoice_line.quantity <= 0: return [] @@ -1328,7 +1330,7 @@ class PurchaseLine(ModelSQL, ModelView): quantity = (self._get_move_quantity(move_type) - self._get_shipped_quantity(move_type)) - quantity = Uom.round(quantity, self.unit.rounding) + quantity = self.unit.round(quantity) if quantity <= 0: return