trytond-patches/sale_fix_invoiced_quantity_calculation.diff
Bernat Brunet Torruella ff90fad934 Update path patches
2015-02-19 10:21:09 +01:00

17 lines
800 B
Diff

# http://codereview.tryton.org/5871002/
diff -r 46c9a4316548 sale.py
--- .a/trytond/trytond/modules/sale/sale.py Thu Dec 04 23:41:16 2014 +0100
+++ .b/trytond/trytond/modules/sale/sale.py Wed Dec 17 21:27:11 2014 +0100
@@ -1365,8 +1369,10 @@
if old_invoice_line.type != 'line':
continue
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,
- old_invoice_line.quantity, self.unit)
+ sign * old_invoice_line.quantity, self.unit)
rounding = self.unit.rounding if self.unit else 0.01
invoice_line.quantity = Uom.round(quantity, rounding)