From b5c7b1403ef8640f384ed7540101786dd2df6b32 Mon Sep 17 00:00:00 2001 From: "Atul Patel (OpenERP)" Date: Mon, 8 Oct 2012 23:24:58 +0530 Subject: [PATCH] [IMP]: Change address using display_address() in follow-up report and overdue report. bzr revid: atp@tinyerp.com-20121008175458-1vqh34vuyw1zimkq --- .../account/report/account_print_overdue.py | 23 ------------------- .../account/report/account_print_overdue.rml | 7 +----- .../report/account_followup_print.py | 6 ----- .../report/account_followup_print.rml | 7 +----- 4 files changed, 2 insertions(+), 41 deletions(-) diff --git a/addons/account/report/account_print_overdue.py b/addons/account/report/account_print_overdue.py index 1b617e9afa4..4ddedc102f5 100644 --- a/addons/account/report/account_print_overdue.py +++ b/addons/account/report/account_print_overdue.py @@ -29,34 +29,11 @@ class Overdue(report_sxw.rml_parse): super(Overdue, self).__init__(cr, uid, name, context=context) self.localcontext.update( { 'time': time, - 'adr_get': self._adr_get, 'getLines': self._lines_get, 'tel_get': self._tel_get, 'message': self._message, }) self.context = context - def _adr_get(self, partner, type): - res = [] - res_partner = pooler.get_pool(self.cr.dbname).get('res.partner') - addresses = res_partner.address_get(self.cr, self.uid, [partner.id], [type]) - adr_id = addresses and addresses[type] or False - result = { - 'name': False, - 'street': False, - 'street2': False, - 'city': False, - 'zip': False, - 'state_id':False, - 'country_id': False, - } - if adr_id: - result = res_partner.read(self.cr, self.uid, [adr_id], context=self.context.copy()) - result[0]['country_id'] = result[0]['country_id'] and result[0]['country_id'][1] or False - result[0]['state_id'] = result[0]['state_id'] and result[0]['state_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/account_print_overdue.rml b/addons/account/report/account_print_overdue.rml index 31f5c25a9b3..34f026d26b5 100644 --- a/addons/account/report/account_print_overdue.rml +++ b/addons/account/report/account_print_overdue.rml @@ -126,15 +126,10 @@ - [[ repeatIn(adr_get(o, 'invoice'),'addr') ]] [[ o.title.name or '' ]] [[ o.name ]] - [[ addr['street'] ]] - [[ addr['street2'] or removeParentNode('para') ]] - [[ addr['zip'] ]] [[ addr['city'] ]] - [[ addr['state_id'] or removeParentNode('para')]] - [[ addr['country_id'] ]] + [[ display_address(o.partner_id)] ]] diff --git a/addons/account_followup/report/account_followup_print.py b/addons/account_followup/report/account_followup_print.py index 8d64ce30f6b..593430691aa 100644 --- a/addons/account_followup/report/account_followup_print.py +++ b/addons/account_followup/report/account_followup_print.py @@ -30,7 +30,6 @@ class report_rappel(report_sxw.rml_parse): self.localcontext.update({ 'time': time, 'ids_to_objects': self._ids_to_objects, - 'adr_get': self._adr_get, 'getLines': self._lines_get, 'get_text': self._get_text }) @@ -43,11 +42,6 @@ class report_rappel(report_sxw.rml_parse): all_lines.append(line) return all_lines - def _adr_get(self, stat_line, type): - res_partner = pooler.get_pool(self.cr.dbname).get('res.partner') - adr = res_partner.address_get(self.cr, self.uid, [stat_line.partner_id.id], [type])[type] - return adr and res_partner.read(self.cr, self.uid, [adr]) or [{}] - def _lines_get(self, stat_by_partner_line): pool = pooler.get_pool(self.cr.dbname) moveline_obj = pool.get('account.move.line') diff --git a/addons/account_followup/report/account_followup_print.rml b/addons/account_followup/report/account_followup_print.rml index 3d096ecf3ac..7f2242991de 100644 --- a/addons/account_followup/report/account_followup_print.rml +++ b/addons/account_followup/report/account_followup_print.rml @@ -129,15 +129,10 @@ - [[ repeatIn(adr_get(o,'invoice'),'a' )]] [[ o.partner_id.name or '' ]] - [[ a['street'] or '']] - [[ a['street2'] or removeParentNode('para') ]] - [[ a['zip'] or '' ]] [[ a['city'] or '' ]] - [[( a['state_id'] and a['state_id'][1]) or removeParentNode('para') ]] - [[( a['country_id'] and a['country_id'][1]) or '']] + [[ display_address(o.partner_id) or '']]