Add patch for issue5016

This commit is contained in:
Sergi Almacellas Abellana 2015-10-06 10:23:21 +02:00
parent e43b3b428a
commit 79111c4fbf
4 changed files with 125 additions and 0 deletions

32
issue16661002_1.diff Normal file
View File

@ -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)

40
issue19491002_1.diff Normal file
View File

@ -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)

50
issue20451002_1.diff Normal file
View File

@ -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:

3
series
View File

@ -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