From 73af560685fc5d6ea873517dbbc174416e8fc74a Mon Sep 17 00:00:00 2001 From: Sergi Almacellas Abellana Date: Thu, 2 Apr 2020 15:25:18 +0200 Subject: [PATCH] Copy invoice lines when synchronizing shipment moves issue9114 review273011002 --- __init__.py | 1 + stock.py | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/__init__.py b/__init__.py index 24bb07ddb2..f34c1d692d 100644 --- a/__init__.py +++ b/__init__.py @@ -11,4 +11,5 @@ def register(): account.InvoiceLineStockMove, account.InvoiceLine, stock.Move, + stock.ShipmentOut, module='account_invoice_stock', type_='model') diff --git a/stock.py b/stock.py index f6a4dd348c..596626e9e9 100644 --- a/stock.py +++ b/stock.py @@ -62,3 +62,13 @@ class Move(metaclass=PoolMeta): 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