[FIX] ORM: Defult_field name in context belongs to curent object only, not to its relationals anymore

lp bug: https://launchpad.net/bugs/384959 fixed

bzr revid: jvo@tinyerp.com-20090617130053-ksodameh18a7ykt3
This commit is contained in:
Christophe Chauvet 2009-06-17 18:30:53 +05:30 committed by Jay (Open ERP)
parent 25820318cb
commit 5e08811185
1 changed files with 16 additions and 2 deletions

View File

@ -2283,9 +2283,16 @@ class orm(orm_template):
# call the 'set' method of fields which are not classic_write
upd_todo.sort(lambda x, y: self._columns[x].priority-self._columns[y].priority)
# default element in context must be remove when call a one2many or many2many
rel_context = context
for c in context.items():
if c[0].startswith('default_'):
del rel_context[c[0]]
for field in upd_todo:
for id in ids:
self._columns[field].set(cr, self, id, field, vals[field], user, context=context)
self._columns[field].set(cr, self, id, field, vals[field], user, context=rel_context)
for table in self._inherits:
col = self._inherits[table]
@ -2484,8 +2491,15 @@ class orm(orm_template):
cr.execute('update '+self._table+' set parent_left=parent_left+2 where parent_left>%s', (pleft,))
cr.execute('update '+self._table+' set parent_right=parent_right+2 where parent_right>%s', (pleft,))
cr.execute('update '+self._table+' set parent_left=%s,parent_right=%s where id=%s', (pleft+1,pleft+2,id_new))
# default element in context must be remove when call a one2many or many2many
rel_context = context
for c in context.items():
if c[0].startswith('default_'):
del rel_context[c[0]]
for field in upd_todo:
self._columns[field].set(cr, self, id_new, field, vals[field], user, context)
self._columns[field].set(cr, self, id_new, field, vals[field], user, rel_context)
self._validate(cr, user, [id_new], context)
result = self._store_get_values(cr, user, [id_new], vals.keys(), context)