From 2864441dc73f8838fd54192d2cd05e95618ee238 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 1 Sep 2018 01:02:03 +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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stock.py b/stock.py index 1a73bd1dc3..caa008830d 100644 --- a/stock.py +++ b/stock.py @@ -171,7 +171,8 @@ class Move(metaclass=PoolMeta): def copy(cls, moves, default=None): if default is None: default = {} - default = default.copy() + else: + default = default.copy() for prefix in ('in_', 'out_'): default.setdefault(prefix + 'anglo_saxon_quantity', getattr(cls, 'default_%sanglo_saxon_quantity' % prefix)())