From 791cd7323e1778bc0bfb681bc66d156dda1baccb Mon Sep 17 00:00:00 2001 From: Vincent Vinet Date: Mon, 11 Aug 2014 13:44:17 -0400 Subject: [PATCH] change the query based on current partner to get partner lines --- .../report/partner_aged_statement_report.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/account_partner_aged_statement_webkit/report/partner_aged_statement_report.py b/account_partner_aged_statement_webkit/report/partner_aged_statement_report.py index 7c308782..6d988b9e 100644 --- a/account_partner_aged_statement_webkit/report/partner_aged_statement_report.py +++ b/account_partner_aged_statement_webkit/report/partner_aged_statement_report.py @@ -177,14 +177,26 @@ class PartnerAgedTrialReport(aged_trial_report): data["form"] = form res = super(PartnerAgedTrialReport, self).set_context( objects, data, ids, report_type=report_type) - if self._partners is not None: - self.query = "{0} AND l.partner_id in ({1})".format( + self.orig_query = self.query + if self._partner is not None: + self.query = "{0} AND l.partner_id = {1}".format( self.query, ", ".join(str(int(i)) for i in self._partners), ) return res + def _get_lines(self, form, partner): + # self.query is used to get the lines in super()._get_lines + self.query = "{0} AND l.partner_id = {1}".format( + self.orig_query, + partner.id, + ) + res = super(PartnerAgedTrialReport, self)._get_lines(form) + self.query = self.orig_query + return res + + report_sxw.report_sxw( 'report.webkit.partner_aged_statement_report', 'res.partner',