From 89c7a9fc3ef943b8e9654ab9bff0c05a950123fb Mon Sep 17 00:00:00 2001 From: Xavier ALT Date: Wed, 23 Oct 2013 13:27:48 +0200 Subject: [PATCH] [FIX] base_contact: fix contact staying attached after settings it's type to standalone --- base_contact/base_contact.py | 12 +++++++++--- base_contact/base_contact_view.xml | 5 +++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/base_contact/base_contact.py b/base_contact/base_contact.py index cb4b79439..038336d5d 100644 --- a/base_contact/base_contact.py +++ b/base_contact/base_contact.py @@ -110,10 +110,16 @@ class res_partner(osv.osv): return result def onchange_contact_id(self, cr, uid, ids, contact_id, context=None): + values = {} if contact_id: - name = self.browse(cr, uid, contact_id, context=context).name - return {'value': {'name': name}} - return {} + values['name'] = self.browse(cr, uid, contact_id, context=context).name + return {'value': values} + + def onchange_contact_type(self, cr, uid, ids, contact_type, context=None): + values = {} + if contact_type == 'standalone': + values['contact_id'] = False + return {'value': values} class ir_actions_window(osv.osv): diff --git a/base_contact/base_contact_view.xml b/base_contact/base_contact_view.xml index 93eeac5aa..29080f270 100644 --- a/base_contact/base_contact_view.xml +++ b/base_contact/base_contact_view.xml @@ -153,7 +153,8 @@

- To see personal information about this contact, please go to to the his person form: + To see personal information about this contact, please go to to the his person form:

@@ -162,7 +163,7 @@
- +