mirror of
https://github.com/NaN-tic/trytond-project_template.git
synced 2023-12-14 02:02:58 +01:00
Adapt signature of "def write()"
This commit is contained in:
parent
96ca30556a
commit
bf94300690
1 changed files with 14 additions and 10 deletions
10
work.py
10
work.py
|
@ -36,9 +36,12 @@ class Work:
|
|||
return works
|
||||
|
||||
@classmethod
|
||||
def write(cls, works, values):
|
||||
def write(cls, *args):
|
||||
transaction = Transaction()
|
||||
context = transaction.context
|
||||
actions = iter(args)
|
||||
args = []
|
||||
for works, values in zip(actions, actions):
|
||||
if 'template' in values and not context.get('template', False):
|
||||
to_update = cls.search([
|
||||
('parent', 'child_of', [w.id for w in works]),
|
||||
|
@ -47,8 +50,9 @@ class Work:
|
|||
|
||||
with transaction.set_context(template=True):
|
||||
cls.write(to_update, {'template': values['template']})
|
||||
del values['template']
|
||||
return super(Work, cls).write(works, values)
|
||||
else:
|
||||
args.extend((works, values))
|
||||
return super(Work, cls).write(*args)
|
||||
|
||||
@classmethod
|
||||
def create_from_template(cls, works, name, effort):
|
||||
|
|
Loading…
Reference in a new issue