trytond-patches/issue20451002_1.diff

51 lines
2.0 KiB
Diff

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: