changeset 0f2550ac4fcc in modules/account_invoice_stock:default
details:
https://hg.tryton.org/modules/account_invoice_stock?cmd=changeset;node=0f2550ac4fcc
description:
Copy invoice lines when synchronizing shipment moves
issue9114
review273011002
diffstat:
__init__.py | 1 +
stock.py | 10 ++++++++++
2 files changed, 11 insertions(+), 0 deletions(-)
diffs (26 lines):
diff -r 2eb2a626eedc -r 0f2550ac4fcc __init__.py
--- a/__init__.py Sat Mar 28 16:51:52 2020 +0100
+++ b/__init__.py Thu Apr 02 15:25:18 2020 +0200
@@ -11,4 +11,5 @@
account.InvoiceLineStockMove,
account.InvoiceLine,
stock.Move,
+ stock.ShipmentOut,
module='account_invoice_stock', type_='model')
diff -r 2eb2a626eedc -r 0f2550ac4fcc stock.py
--- a/stock.py Sat Mar 28 16:51:52 2020 +0100
+++ b/stock.py Thu Apr 02 15:25:18 2020 +0200
@@ -62,3 +62,13 @@
if not Transaction().context.get('_stock_move_split'):
default.setdefault('invoice_lines', None)
return super().copy(moves, default=default)
+
+
+class ShipmentOut(metaclass=PoolMeta):
+ __name__ = 'stock.shipment.out'
+
+ def _sync_outgoing_move(self, template=None):
+ move = super()._sync_outgoing_move(template=template)
+ if template and template.invoice_lines:
+ move.invoice_lines = list(template.invoice_lines)
+ return move