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:
1 parent
1bedcf2427
commit
629faa7e3b
1 file changed
+3
-2
@@ -189,8 +189,9 @@ class Party(DeactivableMixin, ModelSQL, ModelView, MultiValueMixin):
|
||||
def copy(cls, parties, default=None):
|
||||
if default is None:
|
||||
default = {}
|
||||
default = default.copy()
|
||||
default['code'] = None
|
||||
else:
|
||||
default = default.copy()
|
||||
default.setdefault('code', None)
|
||||
return super(Party, cls).copy(parties, default=default)
|
||||
|
||||
@classmethod
|
||||
|
||||
Reference in new issue
Block a user