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
43bfd3dbea
commit
49a059751f
1 file changed
+3
-3
@@ -194,9 +194,9 @@ class Work(DeactivableMixin, ModelSQL, ModelView):
|
||||
def copy(cls, works, default=None):
|
||||
if default is None:
|
||||
default = {}
|
||||
default = default.copy()
|
||||
if 'timesheet_lines' not in default:
|
||||
default['timesheet_lines'] = None
|
||||
else:
|
||||
default = default.copy()
|
||||
default.setdefault('timesheet_lines', None)
|
||||
return super(Work, cls).copy(works, default=default)
|
||||
|
||||
@classmethod
|
||||
|
||||
Reference in new issue
Block a user