[FIX] Avoid to duplicate a field.related
authorStephane Wirtel <stephane@openerp.com>
Wed, 31 Mar 2010 16:59:16 +0000 (18:59 +0200)
committerStephane Wirtel <stephane@openerp.com>
Wed, 31 Mar 2010 16:59:16 +0000 (18:59 +0200)
lp bug: https://launchpad.net/bugs/544087 fixed

bzr revid: stephane@openerp.com-20100331165916-auxhjr19vaaxn139

bin/osv/fields.py
bin/osv/orm.py

index bbe21b9..edf7815 100644 (file)
@@ -756,11 +756,14 @@ class related(function):
                         if self._type != "many2one":
                             t_id = t_data.id
                             t_data = t_data[self.arg[i]][0]
+                        else:
+                            t_data = False
+                            break
                     else:
                         t_id = t_data['id']
                         t_data = t_data[self.arg[i]]
 
-                if t_id:
+                if t_id and t_data:
                     obj.pool.get(field_detail['object']).write(cr,uid,[t_id],{args[-1]:values}, context=context)
 
     def _fnct_read(self, obj, cr, uid, ids, field_name, args, context=None):
index 32efe32..6b78c18 100644 (file)
@@ -3098,7 +3098,8 @@ class orm(orm_template):
                 upd1 = upd1 + ',' + self._columns[field]._symbol_set[0]
                 upd2.append(self._columns[field]._symbol_set[1](vals[field]))
             else:
-                upd_todo.append(field)
+                if not isinstance(self._columns[field], fields.related):
+                    upd_todo.append(field)
             if field in self._columns \
                     and hasattr(self._columns[field], 'selection') \
                     and vals[field]: