[FIX] res_partner: backport of rev 37bf72a
Correctly take the 'use parent address' into account in the onchange. Slightly updated the view that was weird with this parameter. opw 609344
This commit is contained in:
parent
04eff4fe3d
commit
bf353998f2
|
@ -344,6 +344,7 @@ class res_partner(osv.osv, format_address):
|
||||||
value = {}
|
value = {}
|
||||||
value['title'] = False
|
value['title'] = False
|
||||||
if is_company:
|
if is_company:
|
||||||
|
value['use_parent_address'] = False
|
||||||
domain = {'title': [('domain', '=', 'partner')]}
|
domain = {'title': [('domain', '=', 'partner')]}
|
||||||
else:
|
else:
|
||||||
domain = {'title': [('domain', '=', 'contact')]}
|
domain = {'title': [('domain', '=', 'contact')]}
|
||||||
|
@ -363,9 +364,10 @@ class res_partner(osv.osv, format_address):
|
||||||
'was never correctly set. If an existing contact starts working for a new '
|
'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 then a new contact should be created under that new '
|
||||||
'company. You can use the "Discard" button to abandon this change.')}
|
'company. You can use the "Discard" button to abandon this change.')}
|
||||||
parent = self.browse(cr, uid, parent_id, context=context)
|
if use_parent_address:
|
||||||
address_fields = self._address_fields(cr, uid, context=context)
|
parent = self.browse(cr, uid, parent_id, context=context)
|
||||||
result['value'] = dict((key, value_or_id(parent[key])) for key in address_fields)
|
address_fields = self._address_fields(cr, uid, context=context)
|
||||||
|
result['value'] = dict((key, value_or_id(parent[key])) for key in address_fields)
|
||||||
else:
|
else:
|
||||||
result['value'] = {'use_parent_address': False}
|
result['value'] = {'use_parent_address': False}
|
||||||
return result
|
return result
|
||||||
|
|
|
@ -157,8 +157,8 @@
|
||||||
<div>
|
<div>
|
||||||
<field name="use_parent_address" class="oe_edit_only oe_inline"
|
<field name="use_parent_address" class="oe_edit_only oe_inline"
|
||||||
on_change="onchange_address(use_parent_address, parent_id)"
|
on_change="onchange_address(use_parent_address, parent_id)"
|
||||||
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': [('parent_id','=', False),('use_parent_address','=',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"
|
<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)]}"/>
|
attrs="{'invisible': ['|',('parent_id','=', False),('use_parent_address','=',False)]}"/>
|
||||||
<field name="street" placeholder="Street..." attrs="{'readonly': [('use_parent_address','=',True)]}"/>
|
<field name="street" placeholder="Street..." attrs="{'readonly': [('use_parent_address','=',True)]}"/>
|
||||||
|
@ -186,7 +186,7 @@
|
||||||
|
|
||||||
<notebook colspan="4">
|
<notebook colspan="4">
|
||||||
<page string="Contacts" attrs="{'invisible': [('is_company','=',False), ('child_ids', '=', [])]}" autofocus="autofocus">
|
<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>
|
<kanban>
|
||||||
<field name="color"/>
|
<field name="color"/>
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
|
|
Loading…
Reference in New Issue