[FIX] Translation was not getting inserted to DB on write()

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

bzr revid: jvo@tinyerp.com-20100107144749-22zvnh8lfmares2v
This commit is contained in:
ACH,JVO 2010-01-07 20:17:49 +05:30 committed by Jay (Open ERP)
parent 0e7d4a8c8f
commit b4867291bb
1 changed files with 6 additions and 2 deletions

View File

@ -2557,8 +2557,12 @@ class orm(orm_template):
if totranslate:
for f in direct:
if self._columns[f].translate:
src_trans = self.pool.get(self._name).read(cr,user,ids,[f])
self.pool.get('ir.translation')._set_ids(cr, user, self._name+','+f, 'model', context['lang'], ids, vals[f], src_trans[0][f])
src_trans = self.pool.get(self._name).read(cr,user,ids,[f])[0][f]
if not src_trans:
src_trans = vals[f]
# Inserting value to DB
self.write(cr, user, ids, {f:vals[f]})
self.pool.get('ir.translation')._set_ids(cr, user, self._name+','+f, 'model', context['lang'], ids, vals[f], src_trans)
# call the 'set' method of fields which are not classic_write