From 2db7dc08107e9f180ebb5a86b483095ea1674f06 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Wed, 31 Mar 2010 18:59:16 +0200 Subject: [PATCH] [FIX] Avoid to duplicate a field.related lp bug: https://launchpad.net/bugs/544087 fixed bzr revid: stephane@openerp.com-20100331165916-auxhjr19vaaxn139 --- bin/osv/fields.py | 5 ++++- bin/osv/orm.py | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/bin/osv/fields.py b/bin/osv/fields.py index bbe21b9a321..edf78156dcc 100644 --- a/bin/osv/fields.py +++ b/bin/osv/fields.py @@ -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): diff --git a/bin/osv/orm.py b/bin/osv/orm.py index 32efe32558b..6b78c18b83e 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -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]: