[ADD]base/res: improve display address method for printing contact type address
bzr revid: sbh@tinyerp.com-20120306060934-kor7w3upsvpw39gi
This commit is contained in:
@@ -405,7 +405,7 @@ class res_partner(osv.osv):
|
||||
('name','=','main_partner')])[0],
|
||||
).res_id
|
||||
|
||||
def _display_address(self, cr, uid, address, context=None):
|
||||
def _display_address(self, cr, uid, address,type ,context=None):
|
||||
'''
|
||||
The purpose of this function is to build and return an address formatted accordingly to the
|
||||
standards of the country where it belongs.
|
||||
@@ -415,10 +415,17 @@ class res_partner(osv.osv):
|
||||
if not country is specified)
|
||||
:rtype: string
|
||||
'''
|
||||
|
||||
if type:
|
||||
if address.is_company=='partner' and address.child_ids:
|
||||
for child_id in address.child_ids:
|
||||
if child_id.type==type:
|
||||
address=child_id
|
||||
|
||||
# get the information that will be injected into the display format
|
||||
# get the address format
|
||||
address_format = address.country_id and address.country_id.address_format or \
|
||||
'%(street)s\n%(street2)s\n%(city)s,%(state_code)s %(zip)s'
|
||||
# get the information that will be injected into the display format
|
||||
'%(street)s\n%(street2)s\n%(city)s,%(state_code)s %(zip)s'
|
||||
args = {
|
||||
'state_code': address.state_id and address.state_id.code or '',
|
||||
'state_name': address.state_id and address.state_id.name or '',
|
||||
|
||||
@@ -320,8 +320,8 @@ class rml_parse(object):
|
||||
res='%s %s'%(currency_obj.symbol, res)
|
||||
return res
|
||||
|
||||
def display_address(self, address_browse_record):
|
||||
return self.pool.get('res.partner')._display_address(self.cr, self.uid, address_browse_record)
|
||||
def display_address(self, address_browse_record,type=''):
|
||||
return self.pool.get('res.partner')._display_address(self.cr, self.uid, address_browse_record,type)
|
||||
|
||||
def repeatIn(self, lst, name,nodes_parent=False):
|
||||
ret_lst = []
|
||||
|
||||
Reference in New Issue
Block a user