From b4867291bbdf2e2b59629889706f2f361b26b4f1 Mon Sep 17 00:00:00 2001 From: "ACH,JVO" <> Date: Thu, 7 Jan 2010 20:17:49 +0530 Subject: [PATCH] [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 --- bin/osv/orm.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index 2e0778badd6..3f247b9831a 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -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