Adapt signature of "def write()"

This commit is contained in:
jmartin 2014-05-21 10:29:26 +02:00
parent 96ca30556a
commit bf94300690

10
work.py
View file

@ -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):