changeset 2eb2a626eedc in modules/account_invoice_stock:default
details:
https://hg.tryton.org/modules/account_invoice_stock?cmd=changeset;node=2eb2a626eedc
description:
Keep stock moves when credit or correct an invoice
issue9140
review273041002
diffstat:
CHANGELOG | 1 +
account.py | 9 ++++++++-
2 files changed, 9 insertions(+), 1 deletions(-)
diffs (32 lines):
diff -r 97121a9ce873 -r 2eb2a626eedc CHANGELOG
--- a/CHANGELOG Sat Mar 28 16:16:34 2020 +0100
+++ b/CHANGELOG Sat Mar 28 16:51:52 2020 +0100
@@ -1,3 +1,4 @@
+* Keep stock moves when crediting an invoice
* Limit links between invoice line and stock moves
Version 5.4.0 - 2019-11-04
diff -r 97121a9ce873 -r 2eb2a626eedc account.py
--- a/account.py Sat Mar 28 16:16:34 2020 +0100
+++ b/account.py Sat Mar 28 16:51:52 2020 +0100
@@ -3,6 +3,7 @@
from trytond.model import ModelSQL, fields
from trytond.pool import Pool, PoolMeta
from trytond.pyson import Eval, If
+from trytond.transaction import Transaction
class InvoiceLineStockMove(ModelSQL):
@@ -59,5 +60,11 @@
default = {}
else:
default = default.copy()
- default.setdefault('stock_moves', None)
+ if not Transaction().context.get('_account_invoice_correction'):
+ default.setdefault('stock_moves', None)
return super(InvoiceLine, cls).copy(lines, default=default)
+
+ def _credit(self):
+ line = super()._credit()
+ line.stock_moves = self.stock_moves
+ return line