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:
+3
-2
@@ -67,8 +67,9 @@ class Purchase(metaclass=PoolMeta):
|
||||
def copy(cls, purchases, default=None):
|
||||
if default is None:
|
||||
default = {}
|
||||
default = default.copy()
|
||||
default['invoice_lines_ignored'] = None
|
||||
else:
|
||||
default = default.copy()
|
||||
default.setdefault('invoice_lines_ignored', None)
|
||||
return super(Purchase, cls).copy(purchases, default=default)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user