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
20c846a87f
commit
89d5f0510f
1 file changed
+3
-2
+3
-2
@@ -47,6 +47,7 @@ class Invoice(metaclass=PoolMeta):
|
||||
def copy(cls, invoices, default=None):
|
||||
if default is None:
|
||||
default = {}
|
||||
default = default.copy()
|
||||
default['open_date'] = None
|
||||
else:
|
||||
default = default.copy()
|
||||
default.setdefault('open_date', None)
|
||||
return super(Invoice, cls).copy(invoices, default=default)
|
||||
Reference in new issue
Block a user