[FIX] account: Partner Ledger wizard didn't consider all filters and type of entries:

The report generated by this wizard considered all the partners without taking into account
the filters and target entries set.
To show the right partner the function _set_context
must consider the "self.query" which sets the period, the dates, the states, the accounts and
the journals of the sql query used to give the demanded partner.

opw:631649
This commit is contained in:
Goffin Simon 2015-03-30 21:13:30 +02:00
parent 1219b56bcc
commit 680e6889b1
1 changed files with 3 additions and 2 deletions

View File

@ -96,6 +96,7 @@ class third_party_ledger(report_sxw.rml_parse, common_report_header):
if (data['model'] == 'res.partner') and ids:
PARTNER_REQUEST = "AND l.partner_id IN %s"
params += [tuple(ids)]
reconcile = "" if self.reconcil else "AND l.reconcile_id IS NULL "
self.cr.execute(
"SELECT DISTINCT l.partner_id " \
"FROM account_move_line AS l, account_account AS account, " \
@ -104,10 +105,10 @@ class third_party_ledger(report_sxw.rml_parse, common_report_header):
"AND l.account_id = account.id " \
"AND am.id = l.move_id " \
"AND am.state IN %s"
# "AND " + self.query +" " \
"AND " + self.query +" " \
"AND l.account_id IN %s " \
" " + PARTNER_REQUEST + " " \
"AND account.active ", params)
"AND account.active " + reconcile + " ", params)
self.partner_ids = [res['partner_id'] for res in self.cr.dictfetchall()]
objects = obj_partner.browse(self.cr, SUPERUSER_ID, self.partner_ids)
objects.sort(key=lambda x: (x.ref, x.name))