From 79111c4fbfe7e4292de91d5d8ad38a7bfe1f0148 Mon Sep 17 00:00:00 2001 From: Sergi Almacellas Abellana Date: Tue, 6 Oct 2015 10:23:21 +0200 Subject: [PATCH] Add patch for issue5016 --- issue16661002_1.diff | 32 ++++++++++++++++++++++++++++ issue19491002_1.diff | 40 +++++++++++++++++++++++++++++++++++ issue20451002_1.diff | 50 ++++++++++++++++++++++++++++++++++++++++++++ series | 3 +++ 4 files changed, 125 insertions(+) create mode 100644 issue16661002_1.diff create mode 100644 issue19491002_1.diff create mode 100644 issue20451002_1.diff diff --git a/issue16661002_1.diff b/issue16661002_1.diff new file mode 100644 index 0000000..c5300f5 --- /dev/null +++ b/issue16661002_1.diff @@ -0,0 +1,32 @@ +diff -r 1ff52e782b17 account.py +--- a/trytond/trytond/modules/account_invoice_stock/account.py Sun Mar 01 19:44:41 2015 +0100 ++++ b/trytond/trytond/modules/account_invoice_stock/account.py Tue Oct 06 10:01:50 2015 +0200 +@@ -33,3 +33,12 @@ + quantity += Uom.compute_qty(stock_move.uom, stock_move.quantity, + self.unit) + return quantity ++ ++ @property ++ def origin_quantity(self): ++ 'The move quantity computed in origin unit' ++ pool = Pool() ++ Uom = pool.get('product.uom') ++ if not self.origin or not hasattr(self.origin, 'unit'): ++ return self.quantity ++ return Uom.compute_qty(self.unit, self.quantity, self.origin.unit) +diff -r 1ff52e782b17 stock.py +--- a/trytond/trytond/modules/account_invoice_stock/stock.py Sun Mar 01 19:44:41 2015 +0100 ++++ b/trytond/trytond/modules/account_invoice_stock/stock.py Tue Oct 06 10:01:50 2015 +0200 +@@ -23,3 +23,12 @@ + quantity += Uom.compute_qty(invoice_line.unit, + invoice_line.quantity, self.uom) + return quantity ++ ++ @property ++ def origin_quantity(self): ++ 'The move quantity computed in origin unit' ++ pool = Pool() ++ Uom = pool.get('product.uom') ++ if not self.origin or not hasattr(self.origin, 'unit'): ++ return self.quantity ++ return Uom.compute_qty(self.uom, self.quantity, self.origin.unit) diff --git a/issue19491002_1.diff b/issue19491002_1.diff new file mode 100644 index 0000000..ee29461 --- /dev/null +++ b/issue19491002_1.diff @@ -0,0 +1,40 @@ +diff -r dba965a72938 sale.py +--- a/trytond/trytond/modules/sale/sale.py Tue Oct 06 10:07:07 2015 +0200 ++++ b/trytond/trytond/modules/sale/sale.py Tue Oct 06 10:09:08 2015 +0200 +@@ -1132,7 +1132,6 @@ + return 2 + + def get_move_done(self, name): +- Uom = Pool().get('product.uom') + done = True + if not self.product: + return True +@@ -1146,7 +1145,7 @@ + and move.id not in skip_ids: + done = False + break +- quantity -= Uom.compute_qty(move.uom, move.quantity, self.unit) ++ quantity -= move.origin_quantity + if done: + if quantity > 0.0: + done = False +@@ -1356,8 +1355,7 @@ + quantity = 0.0 + for move in self.moves: + if move.state == 'done': +- quantity += Uom.compute_qty(move.uom, move.quantity, +- self.unit) ++ quantity += move.origin_quantity + if move.invoiced_quantity < move.quantity: + stock_moves.append(move) + if self.sale.shipment_method == 'order': +@@ -1371,8 +1369,7 @@ + if old_invoice_line.id not in skip_ids: + sign = (1.0 if invoice_type == old_invoice_line.invoice_type + else -1.0) +- quantity -= Uom.compute_qty(old_invoice_line.unit, +- sign * old_invoice_line.quantity, self.unit) ++ quantity -= sign * old_invoice_line.origin_quantity + + rounding = self.unit.rounding if self.unit else 0.01 + invoice_line.quantity = Uom.round(quantity, rounding) diff --git a/issue20451002_1.diff b/issue20451002_1.diff new file mode 100644 index 0000000..1231c2d --- /dev/null +++ b/issue20451002_1.diff @@ -0,0 +1,50 @@ +diff -r 8ba590e21c94 purchase.py +--- a/trytond/trytond/modules/purchase/purchase.py Tue Oct 06 10:09:51 2015 +0200 ++++ b/trytond/trytond/modules/purchase/purchase.py Tue Oct 06 10:16:28 2015 +0200 +@@ -1048,7 +1048,6 @@ + return 'line' + + def get_move_done(self, name): +- Uom = Pool().get('product.uom') + done = True + if not self.product: + return True +@@ -1062,7 +1061,7 @@ + and move.id not in skip_ids: + done = False + break +- quantity -= Uom.compute_qty(move.uom, move.quantity, self.unit) ++ quantity -= move.origin_quantity + if done: + if quantity > 0.0: + done = False +@@ -1281,8 +1280,7 @@ + quantity = 0.0 + for move in self.moves: + if move.state == 'done': +- quantity += Uom.compute_qty(move.uom, move.quantity, +- self.unit) ++ quantity += move.origin_quantity + if move.invoiced_quantity < move.quantity: + stock_moves.append(move) + invoice_line.stock_moves = stock_moves +@@ -1293,8 +1291,7 @@ + if old_invoice_line.type != 'line': + continue + if old_invoice_line.id not in skip_ids: +- quantity -= Uom.compute_qty(old_invoice_line.unit, +- old_invoice_line.quantity, self.unit) ++ quantity -= old_invoice_line.origin_quantity + + rounding = self.unit.rounding if self.unit else 0.01 + invoice_line.quantity = Uom.round(quantity, rounding) +@@ -1352,8 +1349,7 @@ + quantity = abs(self.quantity) + for move in self.moves: + if move not in skip: +- quantity -= Uom.compute_qty(move.uom, move.quantity, +- self.unit) ++ quantity -= move.origin_quantity + + quantity = Uom.round(quantity, self.unit.rounding) + if quantity <= 0: diff --git a/series b/series index 6fbb196..4d1e924 100644 --- a/series +++ b/series @@ -67,5 +67,8 @@ issue4950_stock.diff issue4950_sale.diff party_after_account.diff issue4986.diff +issue16661002_1.diff +issue19491002_1.diff +issue20451002_1.diff #account_chart_speedup.diff #fix_rounding_in_sync_inventory_to_outgoing.patch