From ebaa30e3f4738939755c8a98892651f5ef74cdc9 Mon Sep 17 00:00:00 2001 From: Guillaume Auger Date: Tue, 27 Jan 2015 16:16:36 -0500 Subject: [PATCH] Port account_chart_report to V8: Changing api for V8 --- account_chart_report/__openerp__.py | 2 +- .../wizard/account_report_chart_of_account.py | 23 +++++++++---------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/account_chart_report/__openerp__.py b/account_chart_report/__openerp__.py index 7d2fbde6..9569f452 100644 --- a/account_chart_report/__openerp__.py +++ b/account_chart_report/__openerp__.py @@ -48,6 +48,6 @@ Contributors 'account_report.xml', 'wizard/account_report_chart_of_account.xml', ], - 'installable': False, + 'installable': True, 'auto_install': False, } diff --git a/account_chart_report/wizard/account_report_chart_of_account.py b/account_chart_report/wizard/account_report_chart_of_account.py index b471bdbf..30254c78 100644 --- a/account_chart_report/wizard/account_report_chart_of_account.py +++ b/account_chart_report/wizard/account_report_chart_of_account.py @@ -20,24 +20,23 @@ # ############################################################################## -from openerp.osv import fields, orm +from openerp import fields, models, api -class ChartOfAccountsReport(orm.TransientModel): +class ChartOfAccountsReport(models.TransientModel): _name = 'account.print.chart.accounts.report' _description = 'Chart of accounts Report' domain_char_account = [('parent_id', '=', False)] - _columns = { - 'chart_account_id': fields.many2one('account.account', - 'Chart of Accounts', - help='Select Charts of Accounts', - required=True, - domain=domain_char_account), - } - - def print_report(self, cr, uid, ids, data, context=None): - res = self.read(cr, uid, ids, context=context)[0] + + chart_account_id = fields.Many2one('account.account', + 'Chart of Accounts', + help='Select Charts of Accounts', + required=True, + domain=domain_char_account) + @api.multi + def print_report(self, data): + res = self.read()[0] account_id = res["chart_account_id"][0] data["form"] = {"id_account": account_id} return {