From 65fab4946d3c7b2cd9f0e17384ec9fb89ebe9c47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 14 May 2008 11:12:11 +0200 Subject: [PATCH] Add CompanyReport to trytond.report --- company.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/company.py b/company.py index 6186293fb0..a05f6b9db8 100644 --- a/company.py +++ b/company.py @@ -3,6 +3,7 @@ import copy from trytond.osv import fields, OSV from trytond.wizard import Wizard, WizardOSV +from trytond.report import Report class Company(OSV): @@ -158,3 +159,21 @@ class CompanyConfig(Wizard): return {} CompanyConfig() + + +class CompanyReport(Report): + + def parse(self, cursor, user_id, report, objects, datas, context): + user_obj = self.pool.get('res.user') + + user = user_obj.browse(cursor, user_id, user_id, context) + if context is None: + context = {} + context = context.copy() + context['company'] = user.company + + return super(CompanyReport, self).parse(cursor, user_id, report, + objects, datas, context) + +import trytond.report +trytond.report.CompanyReport = CompanyReport