diff --git a/addons/account/report/overdue.py b/addons/account/report/overdue.py index 736a4a78138..633fcd6a0a0 100644 --- a/addons/account/report/overdue.py +++ b/addons/account/report/overdue.py @@ -38,11 +38,25 @@ class Overdue(report_sxw.rml_parse): }) def _adr_get(self, partner, type): + res = [] res_partner = pooler.get_pool(self.cr.dbname).get('res.partner') res_partner_address = pooler.get_pool(self.cr.dbname).get('res.partner.address') addresses = res_partner.address_get(self.cr, self.uid, [partner.id], [type]) adr_id = addresses and addresses[type] or False - return adr_id and res_partner_address.read(self.cr, self.uid, [adr_id])[0] or False + result = { + 'name': False, + 'street': False, + 'city' : False, + 'zip' : False, + 'country_id' : False, + } + if adr_id: + result = res_partner_address.read(self.cr, self.uid, [adr_id]) + result[0]['country_id'] = result[0]['country_id'] and result[0]['country_id'][1] or False + return result + + res.append(result) + return res def _tel_get(self,partner): if not partner: diff --git a/addons/account/report/overdue.rml b/addons/account/report/overdue.rml index aa0d111b28f..70f5fd09b25 100644 --- a/addons/account/report/overdue.rml +++ b/addons/account/report/overdue.rml @@ -90,16 +90,14 @@ - - - + [[ repeatIn(adr_get(o, 'invoice'),'addr') ]] [[ o.name ]] - [[ adr_get(o, 'invoice')['name'] ]] - [[ adr_get(o, 'invoice')['street'] ]] - [[ adr_get(o, 'invoice')['zip'] ]] [[ adr_get(o, 'invoice')['city'] ]] - [[ adr_get(o, 'invoice')['country_id'] and adr_get(o, 'invoice')['country_id'][1] ]] + [[ addr['name'] ]] + [[ addr['street'] ]] + [[ addr['zip'] ]] [[ addr['city'] ]] + [[ addr['country_id'] ]]