[Fix] [IMP] base/res :fix the update record issue

bzr revid: sbh@tinyerp.com-20120228114505-qmlbye3bgfqxfw3g
This commit is contained in:
Bhumika (OpenERP)
2012-02-28 17:15:05 +05:30
parent 5357066185
commit c8f9b2f5bf
2 changed files with 10 additions and 9 deletions
+9 -8
View File
@@ -189,9 +189,9 @@ class res_partner(osv.osv):
def do_share(self, cr, uid, ids, *args):
return True
def onchange_type(self, cr, uid, ids, is_company, title, context=None):
def onchange_type(self, cr, uid, ids, is_company, title, child_ids,context=None):
if is_company == 'contact':
return {'value': {'is_company': is_company, 'title': '','child_ids':''}}
return {'value': {'is_company': is_company, 'title': '','child_ids':[(5,)]}}
elif is_company == 'partner':
return {'value': {'is_company': is_company, 'title': '','parent_id':''}}
return {'value': {'is_comapny': '', 'title': ''}}
@@ -254,16 +254,17 @@ class res_partner(osv.osv):
def udpate_address(self,cr,uid,update_ids,vals, context=None):
# Remove this after all testing
for id in update_ids:
for key, data in vals.iteritems():
if data:
if key in ('street','street2','zip','city','state_id','country_id','email','phone','fax','mobile','website','ref','lang'):
sql = "update res_partner set %(field)s = %%(value)s where id = %%(id)s" % {
'field': key,
}
'field': key,
}
cr.execute(sql, {
'value': data,
'id':id
})
'value': data,
'id':id
})
return True
# _constraints = [(_check_ean_key, 'Error: Invalid ean code', ['ean13'])]
+1 -1
View File
@@ -328,7 +328,7 @@
<form string="Partners">
<group col="8" colspan="4">
<group col="2">
<field name="is_company" on_change="onchange_type(is_company, title)" attrs="{'required': True}"/>
<field name="is_company" on_change="onchange_type(is_company, title,child_ids)" attrs="{'required': True}"/>
<field name="function" attrs="{'invisible': [('is_company','=', 'partner')]}" colspan="2"/>
<field name="title" size="0" groups="base.group_extended" domain="[('domain', '=', is_company)]"/>
</group>