[MERGE] [IMP] res_partner: correctly take the 'use parent address'
into account in the onchange. Slightly updated the view that was weird with this parameter. bzr revid: tde@openerp.com-20140417145522-yte3976um2a1t0dr
This commit is contained in:
commit
37bf72aca5
|
@ -360,6 +360,7 @@ class res_partner(osv.osv, format_address):
|
|||
value = {}
|
||||
value['title'] = False
|
||||
if is_company:
|
||||
value['use_parent_address'] = False
|
||||
domain = {'title': [('domain', '=', 'partner')]}
|
||||
else:
|
||||
domain = {'title': [('domain', '=', 'contact')]}
|
||||
|
@ -379,9 +380,10 @@ class res_partner(osv.osv, format_address):
|
|||
'was never correctly set. If an existing contact starts working for a new '
|
||||
'company then a new contact should be created under that new '
|
||||
'company. You can use the "Discard" button to abandon this change.')}
|
||||
parent = self.browse(cr, uid, parent_id, context=context)
|
||||
address_fields = self._address_fields(cr, uid, context=context)
|
||||
result['value'] = dict((key, value_or_id(parent[key])) for key in address_fields)
|
||||
if use_parent_address:
|
||||
parent = self.browse(cr, uid, parent_id, context=context)
|
||||
address_fields = self._address_fields(cr, uid, context=context)
|
||||
result['value'] = dict((key, value_or_id(parent[key])) for key in address_fields)
|
||||
else:
|
||||
result['value'] = {'use_parent_address': False}
|
||||
return result
|
||||
|
|
|
@ -158,8 +158,8 @@
|
|||
<div>
|
||||
<field name="use_parent_address" class="oe_edit_only oe_inline"
|
||||
on_change="onchange_address(use_parent_address, parent_id)"
|
||||
attrs="{'invisible': [('parent_id','=', False),('use_parent_address','=',False)]}"/>
|
||||
<label for="use_parent_address" class="oe_edit_only" attrs="{'invisible': [('parent_id','=', False),('use_parent_address','=',False)]}"/>
|
||||
attrs="{'invisible': ['|', ('is_company', '=', True),('parent_id', '=', False)]}"/>
|
||||
<label for="use_parent_address" class="oe_edit_only" attrs="{'invisible': ['|', ('is_company', '=', True), ('parent_id', '=', False)]}"/>
|
||||
<button name="open_parent" type="object" string="(edit company address)" class="oe_link oe_edit_only"
|
||||
attrs="{'invisible': ['|',('parent_id','=', False),('use_parent_address','=',False)]}"/>
|
||||
<field name="street" placeholder="Street..." attrs="{'readonly': [('use_parent_address','=',True)]}"/>
|
||||
|
@ -188,7 +188,7 @@
|
|||
|
||||
<notebook colspan="4">
|
||||
<page string="Contacts" attrs="{'invisible': [('is_company','=',False), ('child_ids', '=', [])]}" autofocus="autofocus">
|
||||
<field name="child_ids" mode="kanban" context="{'default_parent_id': active_id, 'default_street': street, 'default_street2': street2, 'default_city': city, 'default_state_id': state_id, 'default_zip': zip, 'default_country_id': country_id, 'default_supplier': supplier, 'default_customer': customer}">
|
||||
<field name="child_ids" mode="kanban" context="{'default_parent_id': active_id, 'default_street': street, 'default_street2': street2, 'default_city': city, 'default_state_id': state_id, 'default_zip': zip, 'default_country_id': country_id, 'default_supplier': supplier, 'default_customer': customer, 'default_use_parent_address': True}">
|
||||
<kanban>
|
||||
<field name="color"/>
|
||||
<field name="name"/>
|
||||
|
|
Loading…
Reference in New Issue