Browse Source

[FIX] base_contact: fix contact staying attached after settings it's type to standalone

pull/2/head
Xavier ALT 11 years ago
committed by Sandy Carter
parent
commit
89c7a9fc3e
  1. 12
      base_contact/base_contact.py
  2. 5
      base_contact/base_contact_view.xml

12
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):

5
base_contact/base_contact_view.xml

@ -153,7 +153,8 @@
</page>
<page name="personal-info" string="Personal Information" attrs="{'invisible': ['|',('is_company','=',True)]}">
<p attrs="{'invisible': [('contact_id','=',False)]}">
To see personal information about this contact, please go to to the his person form: <field name="contact_id" class="oe_inline" domain="[('contact_type','!=','attached')]" context="{'show_address': 1}" options="{'always_reload': True}"/>
To see personal information about this contact, please go to to the his person form: <field name="contact_id" class="oe_inline" domain="[('contact_type','!=','attached')]" context="{'show_address': 1}"
on_change="onchange_contact_id(contact_id)" options="{'always_reload': True}"/>
</p>
<group attrs="{'invisible': [('contact_id','!=',False)]}">
<field name="birthdate_date"/>
@ -162,7 +163,7 @@
</page>
</page>
<xpath expr="//field[@name='child_ids']/form//field[@name='name']/.." position="before">
<field name="contact_type" readonly="0"/>
<field name="contact_type" readonly="0" on_change="onchange_contact_type(contact_type)"/>
</xpath>
<xpath expr="//field[@name='child_ids']/form//field[@name='name']" position="after">
<field name="contact_id" on_change="onchange_contact_id(contact_id)" string="Contact"

Loading…
Cancel
Save