[FIX] account: multi-company partner ledger.

If a customer changed of company while having
account.move.line records in the former company he was in
It wasn't possible for someone else than the admin
to print the partner ledger report including this partner.

opw-631800
This commit is contained in:
Denis Ledoux 2015-03-31 11:04:40 +02:00
parent e311a423cd
commit 31e10ec0a0
1 changed files with 2 additions and 1 deletions

View File

@ -23,6 +23,7 @@ import time
import re
from openerp.report import report_sxw
from common_report_header import common_report_header
from openerp import SUPERUSER_ID
from openerp.tools.translate import _
class third_party_ledger(report_sxw.rml_parse, common_report_header):
@ -108,7 +109,7 @@ class third_party_ledger(report_sxw.rml_parse, common_report_header):
" " + PARTNER_REQUEST + " " \
"AND account.active ", params)
self.partner_ids = [res['partner_id'] for res in self.cr.dictfetchall()]
objects = obj_partner.browse(self.cr, self.uid, self.partner_ids)
objects = obj_partner.browse(self.cr, SUPERUSER_ID, self.partner_ids)
objects.sort(key=lambda x: (x.ref, x.name))
return super(third_party_ledger, self).set_context(objects, data, self.partner_ids, report_type)