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
This commit is contained in:
Cédric Krier
2018-09-01 01:02:04 +02:00
parent 7f662b8981
commit 998f45f62b
+3 -2
View File
@@ -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