Don't lost other modifications when template field is modified

This commit is contained in:
Guillem Barba 2014-06-03 18:36:45 +02:00
parent 7d78b5e599
commit 950a059025
1 changed files with 5 additions and 3 deletions

View File

@ -1,5 +1,5 @@
#The COPYRIGHT file at the top level of this repository contains the full
#copyright notices and license terms.
# The COPYRIGHT file at the top level of this repository contains the full
# copyright notices and license terms.
from trytond.model import ModelView, fields
from trytond.pool import Pool, PoolMeta
from trytond.pyson import Eval
@ -7,7 +7,6 @@ from trytond.transaction import Transaction
from trytond.wizard import Wizard, StateView, StateTransition, Button
__all__ = ['Work', 'CreateFromTemplateStart', 'CreateFromTemplate']
__metaclass__ = PoolMeta
@ -50,6 +49,9 @@ class Work:
with transaction.set_context(template=True):
cls.write(to_update, {'template': values['template']})
del values['template']
if values:
args.extend((works, values))
else:
args.extend((works, values))
return super(Work, cls).write(*args)