[IMP] res_partner: address onchange method add
bzr revid: kjo@tinyerp.com-20120223061346-co33pf7qi05b46hx
This commit is contained in:
@@ -189,6 +189,14 @@ class res_partner(osv.osv):
|
||||
|
||||
def do_share(self, cr, uid, ids, *args):
|
||||
return True
|
||||
|
||||
def onchange_address(self, cr, uid, ids, is_company_address, parent_id, context=None):
|
||||
if is_company_address != False and parent_id:
|
||||
data = self.read(cr, uid, parent_id, ['street', 'street2', 'zip', 'city', 'email', 'phone', 'fax', 'mobile', 'country_id', 'state_id', 'website', 'ref', 'lang'], context=context)
|
||||
else:
|
||||
data = self.read(cr, uid, ids[0], ['street', 'street2', 'zip', 'city', 'email', 'phone', 'fax', 'mobile', 'country_id', 'state_id', 'website', 'ref', 'lang'], context=context)
|
||||
|
||||
return {'value': {'street': data['street'], 'street2':data['street2'], 'zip':data['zip'], 'city':data['city'], 'email':data['email'], 'phone':data['phone'], 'fax':data['fax'], 'mobile':data['mobile'], 'country_id':data['country_id'], 'state_id':data['state_id'], 'website':data['website'], 'ref':data['ref'], 'lang':data['lang']}}
|
||||
|
||||
def _check_ean_key(self, cr, uid, ids, context=None):
|
||||
for partner_o in pooler.get_pool(cr.dbname).get('res.partner').read(cr, uid, ids, ['ean13',]):
|
||||
|
||||
@@ -314,8 +314,6 @@
|
||||
<field name="function"/>
|
||||
<field name="phone"/>
|
||||
<field name="email"/>
|
||||
<!--field name="country"/-->
|
||||
<field name="user_id"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
@@ -330,10 +328,10 @@
|
||||
<group colspan="4" col="4">
|
||||
<group col="2">
|
||||
<field name="name" select="1"/>
|
||||
<field name="title" size="0" groups="base.group_extended"/>
|
||||
<field name="function"/>
|
||||
</group>
|
||||
<group col="2">
|
||||
<field name="function"/>
|
||||
<field name="title" size="0" groups="base.group_extended"/>
|
||||
<field name="parent_id" string="Parent Company" groups="base.group_extended" attrs="{'invisible': [('is_company','=', True)]}"/>
|
||||
</group>
|
||||
</group>
|
||||
@@ -343,7 +341,7 @@
|
||||
</group>
|
||||
<group col="2">
|
||||
<field name="is_company" select="1"/>
|
||||
<field name="is_company_address"/>
|
||||
<field name="is_company_address" on_change="onchange_address(is_company_address, parent_id)"/>
|
||||
</group>
|
||||
<group col="2">
|
||||
<field name="photo" widget='image' nolabel="1"/>
|
||||
@@ -353,27 +351,25 @@
|
||||
<notebook colspan="4">
|
||||
<page string="General">
|
||||
<newline/>
|
||||
<group colspan="4" attrs="{'invisible': [('is_company_address', '=', True)]}">
|
||||
<group colspan="2" col="4" >
|
||||
<separator string="Address" colspan="4" col="4" />
|
||||
<field name="type" string="Type" colspan="2" attrs="{'invisible': [('is_company', '=', True)]}"/>
|
||||
<field name="street" colspan="4"/>
|
||||
<field name="street2" colspan="4"/>
|
||||
<field name="zip"/>
|
||||
<field name="city"/>
|
||||
<field name="country_id" completion="1"/>
|
||||
<field name="state_id"/>
|
||||
<field name="street" colspan="4" attrs="{'readonly': [('is_company','=', True)]}"/>
|
||||
<field name="street2" colspan="4" attrs="{'readonly': [('is_company','=', True)]}"/>
|
||||
<field name="zip" attrs="{'readonly': [('is_company','=', True)]}"/>
|
||||
<field name="city" attrs="{'readonly': [('is_company','=', True)]}"/>
|
||||
<field name="country_id" completion="1" attrs="{'readonly': [('is_company','=', True)]}"/>
|
||||
<field name="state_id" attrs="{'readonly': [('is_company','=', True)]}"/>
|
||||
</group>
|
||||
<group colspan="2" col="4">
|
||||
<separator string="Communication" colspan="4"/>
|
||||
<field name="phone" colspan="4"/>
|
||||
<field name="mobile" colspan="4"/>
|
||||
<field name="fax" colspan="4"/>
|
||||
<field name="email" widget="email" colspan="4"/>
|
||||
<field name="website" widget="url" colspan="4"/>
|
||||
<field name="ref" groups="base.group_extended" colspan="4"/>
|
||||
<field name="lang" colspan="4"/>
|
||||
</group>
|
||||
<field name="phone" colspan="4" attrs="{'readonly': [('is_company','=', True)]}"/>
|
||||
<field name="mobile" colspan="4" attrs="{'readonly': [('is_company','=', True)]}"/>
|
||||
<field name="fax" colspan="4" attrs="{'readonly': [('is_company','=', True)]}"/>
|
||||
<field name="email" widget="email" colspan="4" attrs="{'readonly': [('is_company','=', True)]}"/>
|
||||
<field name="website" widget="url" colspan="4" attrs="{'readonly': [('is_company','=', True)]}"/>
|
||||
<field name="ref" groups="base.group_extended" colspan="4" attrs="{'readonly': [('is_company','=', True)]}"/>
|
||||
<field name="lang" colspan="4" attrs="{'readonly': [('is_company','=', True)]}"/>
|
||||
</group>
|
||||
<group colspan="4" attrs="{'invisible': [('is_company','=', False)]}">
|
||||
<field name="child_ids" nolabel="1"/>
|
||||
|
||||
Reference in New Issue
Block a user