From 6bd5c59c47fa2f7b0fa452f05095c41ba88ee4fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 22 Sep 2015 22:57:05 +0200 Subject: [PATCH] Don't copy moves or invoice_lines issue4980 review24411002 --- account.py | 9 +++++++++ stock.py | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/account.py b/account.py index 60d853d280..64dca57111 100644 --- a/account.py +++ b/account.py @@ -38,3 +38,12 @@ class InvoiceLine: quantity += Uom.compute_qty(stock_move.uom, stock_move.quantity, self.unit) return quantity + + @classmethod + def copy(cls, lines, default=None): + if default is None: + default = {} + else: + default = default.copy() + default.setdefault('stock_moves', None) + return super(InvoiceLine, cls).copy(lines, default=default) diff --git a/stock.py b/stock.py index 1e41bda3d4..14dcf4a2fc 100644 --- a/stock.py +++ b/stock.py @@ -23,3 +23,12 @@ class StockMove: quantity += Uom.compute_qty(invoice_line.unit, invoice_line.quantity, self.uom) return quantity + + @classmethod + def copy(cls, moves, default=None): + if default is None: + default = {} + else: + default = default.copy() + default.setdefault('invoice_lines', None) + return super(StockMove, cls).copy(moves, default=default)