changeset 4539f4758d35 in modules/account_invoice_stock:default
details:
https://hg.tryton.org/modules/account_invoice_stock?cmd=changeset;node=4539f4758d35
description:
Skip canceled move and invoice when computing quantity
This ensures that newly recreated invoices or moves are still linked as
quantity will be lower.
issue9032
review258971002
diffstat:
account.py | 5 +++--
stock.py | 5 +++--
2 files changed, 6 insertions(+), 4 deletions(-)
diffs (30 lines):
diff -r f0039374936c -r 4539f4758d35 account.py
--- a/account.py Thu Mar 19 18:59:51 2020 +0100
+++ b/account.py Thu Mar 26 00:11:06 2020 +0100
@@ -31,8 +31,9 @@
Uom = pool.get('product.uom')
quantity = 0
for stock_move in self.stock_moves:
- quantity += Uom.compute_qty(stock_move.uom, stock_move.quantity,
- self.unit)
+ if stock_move.state != 'cancel':
+ quantity += Uom.compute_qty(
+ stock_move.uom, stock_move.quantity, self.unit)
return quantity
@classmethod
diff -r f0039374936c -r 4539f4758d35 stock.py
--- a/stock.py Thu Mar 19 18:59:51 2020 +0100
+++ b/stock.py Thu Mar 26 00:11:06 2020 +0100
@@ -17,8 +17,9 @@
Uom = pool.get('product.uom')
quantity = 0
for invoice_line in self.invoice_lines:
- quantity += Uom.compute_qty(invoice_line.unit,
- invoice_line.quantity, self.uom)
+ if invoice_line.invoice_state != 'cancel':
+ quantity += Uom.compute_qty(
+ invoice_line.unit, invoice_line.quantity, self.uom)
return quantity
@classmethod