From 998f45f62bd09f425d4e5cfee37df314c1bf36ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 1 Sep 2018 01:02:04 +0200 Subject: [PATCH] Improve ModelStorage.copy * Allow callable in copy default * Support dotted notation in copy default * Use setdefault in copy * Copy default when needed * Do not set default state in copy * Use callable and dotted notation in copy default issue5576 issue7648 review72291002 --- stock.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/stock.py b/stock.py index b1725cf885..fff761839e 100644 --- a/stock.py +++ b/stock.py @@ -351,8 +351,9 @@ class ShipmentDrop(Workflow, ModelSQL, ModelView): def copy(cls, shipments, default=None): if default is None: default = {} - default = default.copy() - default['moves'] = None + else: + default = default.copy() + default.setdefault('moves', None) return super(ShipmentDrop, cls).copy(shipments, default=default) @classmethod