From 13fa85ae5e5cf6f8f33e553d52e90bb00787ef49 Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Thu, 14 Dec 2017 15:37:54 +0100 Subject: [PATCH] [FIX] lints --- account_financial_report/report/parser.py | 69 ++++++++-------- account_financial_report/wizard/wizard.py | 32 ++++---- .../__openerp__.py | 3 +- .../data/financial_webkit_header.xml | 2 +- .../models/account.py | 22 ++---- .../report/aged_open_invoices.py | 1 + .../report/aged_partner_balance.py | 1 + .../report/common_balance_reports.py | 2 +- .../report/common_partner_balance_reports.py | 2 +- .../report/common_partner_reports.py | 2 +- .../report/common_reports.py | 12 +-- .../report/general_ledger.py | 3 +- .../report/open_invoices.py | 14 ++-- .../report/partner_balance.py | 4 +- .../report/partners_ledger.py | 7 +- .../report/print_journal.py | 3 +- .../report/trial_balance.py | 3 +- .../report/webkit_parser_header_fix.py | 3 +- .../wizard/aged_open_invoices_wizard.py | 12 +-- .../wizard/aged_open_invoices_wizard.xml | 1 + .../wizard/aged_partner_balance_wizard.py | 35 ++++----- .../wizard/aged_partner_balance_wizard.xml | 1 + .../wizard/balance_common.py | 78 ++++++++++--------- .../wizard/general_ledger_wizard.py | 54 ++++++------- .../wizard/general_ledger_wizard_view.xml | 1 + .../wizard/open_invoices_wizard.py | 28 ++++--- .../wizard/open_invoices_wizard_view.xml | 1 + .../wizard/partner_balance_wizard.py | 1 + .../wizard/partner_balance_wizard_view.xml | 1 + .../wizard/partners_ledger_wizard.py | 48 ++++++------ .../wizard/partners_ledger_wizard_view.xml | 1 + .../wizard/print_journal.py | 24 +++--- .../wizard/print_journal_view.xml | 1 + .../wizard/trial_balance_wizard.py | 8 +- .../wizard/trial_balance_wizard_view.xml | 1 + .../__openerp__.py | 1 - .../report/aged_open_invoices_xls.py | 1 + .../report/aged_partner_balance_xls.py | 1 + .../report/general_ledger_xls.py | 8 +- .../report/open_invoices_xls.py | 6 +- .../report/partner_ledger_xls.py | 8 +- .../report/partners_balance_xls.py | 8 +- .../report/trial_balance_xls.py | 1 + .../wizard/aged_open_invoices_wizard.py | 2 + .../wizard/aged_partner_balance_wizard.py | 2 + .../wizard/general_ledger_wizard.py | 2 + .../wizard/general_ledger_wizard_view.xml | 1 + .../wizard/open_invoices_wizard.py | 2 + .../wizard/open_invoices_wizard_view.xml | 1 + .../wizard/partners_balance_wizard.py | 2 + .../wizard/partners_ledger_wizard.py | 2 + .../wizard/partners_ledger_wizard_view.xml | 1 + .../wizard/trial_balance_wizard.py | 2 + .../wizard/trial_balance_wizard_view.xml | 1 + account_journal_report_xls/__openerp__.py | 2 +- account_journal_report_xls/account_journal.py | 11 ++- .../report/nov_account_journal.py | 16 ++-- .../report/nov_account_journal_xls.py | 32 ++++---- .../wizard/print_journal_wizard.py | 48 ++++++------ .../wizard/print_journal_wizard.xml | 10 +-- 60 files changed, 350 insertions(+), 302 deletions(-) diff --git a/account_financial_report/report/parser.py b/account_financial_report/report/parser.py index e92f9f10..b99d0d64 100644 --- a/account_financial_report/report/parser.py +++ b/account_financial_report/report/parser.py @@ -165,10 +165,11 @@ class account_balance(report_sxw.rml_parse): def exchange_name(self, form): self.from_currency_id = self.\ - get_company_currency(form['company_id'] - and type(form['company_id']) in (list, tuple) - and form['company_id'][0] - or form['company_id']) + get_company_currency( + form['company_id'] and + type(form['company_id']) in (list, tuple) and + form['company_id'][0] or form['company_id'] + ) if not form['currency_id']: self.to_currency_id = self.from_currency_id else: @@ -543,17 +544,18 @@ class account_balance(report_sxw.rml_parse): self.context['state'] = form['target_move'] or 'posted' self.from_currency_id = self.\ - get_company_currency(form['company_id'] - and type(form['company_id']) in (list, tuple) - and form['company_id'][0] - or form['company_id']) + get_company_currency( + form['company_id'] and + type(form['company_id']) in (list, tuple) and + form['company_id'][0] or form['company_id'] + ) if not form['currency_id']: self.to_currency_id = self.from_currency_id else: - self.to_currency_id = form['currency_id'] \ - and type(form['currency_id']) in (list, tuple) \ - and form['currency_id'][0] \ - or form['currency_id'] + self.to_currency_id = form['currency_id'] and\ + type(form['currency_id']) in (list, tuple) and\ + form['currency_id'][0] or\ + form['currency_id'] if 'account_list' in form and form['account_list']: account_ids = form['account_list'] @@ -561,16 +563,18 @@ class account_balance(report_sxw.rml_parse): del form['account_list'] credit_account_ids = self.\ - get_company_accounts(form['company_id'] - and type(form['company_id']) in (list, tuple) - and form['company_id'][0] - or form['company_id'], 'credit') + get_company_accounts( + form['company_id'] and + type(form['company_id']) in (list, tuple) and + form['company_id'][0] or form['company_id'], 'credit' + ) debit_account_ids = self.\ - get_company_accounts(form['company_id'] - and type(form['company_id']) in (list, tuple) - and form['company_id'][0] - or form['company_id'], 'debit') + get_company_accounts( + form['company_id'] and + type(form['company_id']) in (list, tuple) and + form['company_id'][0] or form['company_id'], 'debit' + ) if form.get('fiscalyear'): if type(form.get('fiscalyear')) in (list, tuple): @@ -587,9 +591,8 @@ class account_balance(report_sxw.rml_parse): account_ids = _get_children_and_consol( self.cr, self.uid, account_ids, - form['display_account_level'] - and form['display_account_level'] - or 100, self.context) + form['display_account_level'] and form['display_account_level'] or + 100, self.context) credit_account_ids = _get_children_and_consol( self.cr, self.uid, credit_account_ids, 100, self.context, @@ -622,16 +625,16 @@ class account_balance(report_sxw.rml_parse): ('special', '=', False)], order='date_start asc') a = 0 - l = [] + l1 = [] p = [] for x in period_ids: a += 1 if a < 3: - l.append(x) + l1.append(x) else: - l.append(x) - p.append(l) - l = [] + l1.append(x) + p.append(l1) + l1 = [] a = 0 tot_bal1 = 0.0 tot_bal2 = 0.0 @@ -845,15 +848,14 @@ class account_balance(report_sxw.rml_parse): 'id': id, 'type': aa_id[3].type, 'code': aa_id[3].code, - 'name': (aa_id[2] and not aa_id[1]) - and 'TOTAL %s' % (aa_id[3].name.upper()) - or aa_id[3].name, + 'name': (aa_id[2] and not aa_id[1]) and + 'TOTAL %s' % (aa_id[3].name.upper()) or aa_id[3].name, 'parent_id': aa_id[3].parent_id and aa_id[3].parent_id.id, 'level': aa_id[3].level, 'label': aa_id[1], 'total': aa_id[2], - 'change_sign': credit_account_ids - and (id in credit_account_ids and -1 or 1) or 1 + 'change_sign': credit_account_ids and + (id in credit_account_ids and -1 or 1) or 1 } if form['columns'] == 'qtr': @@ -1174,6 +1176,7 @@ class account_balance(report_sxw.rml_parse): result_acc.append(res2) return result_acc + report_sxw.report_sxw( 'report.afr.1cols', 'wizard.report', diff --git a/account_financial_report/wizard/wizard.py b/account_financial_report/wizard/wizard.py index 717300a9..82e51690 100644 --- a/account_financial_report/wizard/wizard.py +++ b/account_financial_report/wizard/wizard.py @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ########################################################################### # Module Writen to OpenERP, Open Source Management Solution # Copyright (C) OpenERP Venezuela (). @@ -25,13 +25,11 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . ############################################################################## - -from openerp.osv import osv, fields +from openerp import _, fields, models import time -from openerp.tools.translate import _ -class wizard_report(osv.osv_memory): +class WizardReport(models.TransientModel): _name = "wizard.report" _columns = { @@ -208,20 +206,20 @@ class wizard_report(osv.osv_memory): return res afr_brw = self.pool.get('afr').browse(cr, uid, afr_id, context=context) res['value'].update({ - 'currency_id': afr_brw.currency_id - and afr_brw.currency_id.id - or afr_brw.company_id.currency_id.id}) + 'currency_id': afr_brw.currency_id and afr_brw.currency_id.id or + afr_brw.company_id.currency_id.id, + }) res['value'].update({'inf_type': afr_brw.inf_type or 'BS'}) res['value'].update({'columns': afr_brw.columns or 'five'}) res['value'].update({ - 'display_account': afr_brw.display_account - or 'bal_mov'}) + 'display_account': afr_brw.display_account or 'bal_mov', + }) res['value'].update({ - 'display_account_level': afr_brw. - display_account_level or 0}) + 'display_account_level': afr_brw.display_account_level or 0 + }) res['value'].update({ - 'fiscalyear': afr_brw.fiscalyear_id - and afr_brw.fiscalyear_id.id}) + 'fiscalyear': afr_brw.fiscalyear_id and afr_brw.fiscalyear_id.id + }) res['value'].update({'account_list': [ acc.id for acc in afr_brw.account_ids]}) res['value'].update({'periods': [p.id for p in afr_brw.period_ids]}) @@ -270,8 +268,8 @@ class wizard_report(osv.osv_memory): res = cr.dictfetchall() if res: - if (data['form']['date_to'] > res[0]['date_stop'] - or data['form']['date_from'] < res[0]['date_start']): + if data['form']['date_to'] > res[0]['date_stop'] or\ + data['form']['date_from'] < res[0]['date_start']): raise osv.except_osv(_('UserError'), 'Las fechas deben estar entre %s y %s' % (res[0]['date_start'], @@ -369,5 +367,3 @@ class wizard_report(osv.osv_memory): return {'type': 'ir.actions.report.xml', 'report_name': name, 'datas': data} - -wizard_report() diff --git a/account_financial_report_webkit/__openerp__.py b/account_financial_report_webkit/__openerp__.py index d77c80a5..5ec2018c 100644 --- a/account_financial_report_webkit/__openerp__.py +++ b/account_financial_report_webkit/__openerp__.py @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ############################################################################## # # Authors: Nicolas Bessi, Guewen Baconnier @@ -57,7 +57,6 @@ 'test/open_invoices.yml', 'test/aged_trial_balance.yml'], # 'tests/account_move_line.yml' - 'active': False, 'installable': True, 'application': True, 'pre_init_hook': 'pre_init_hook', diff --git a/account_financial_report_webkit/data/financial_webkit_header.xml b/account_financial_report_webkit/data/financial_webkit_header.xml index a4d6d618..063690a5 100644 --- a/account_financial_report_webkit/data/financial_webkit_header.xml +++ b/account_financial_report_webkit/data/financial_webkit_header.xml @@ -394,7 +394,7 @@ act_as_colgroup { .account_level_consol { font-weight: normal; - font-style: italic; + font-style: italic; } .overflow_ellipsis { diff --git a/account_financial_report_webkit/models/account.py b/account_financial_report_webkit/models/account.py index 4e1118ee..177f41d4 100644 --- a/account_financial_report_webkit/models/account.py +++ b/account_financial_report_webkit/models/account.py @@ -27,21 +27,15 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # ############################################################################## +from openerp import models, fields -from openerp.osv import fields, orm - -class AccountAccount(orm.Model): +class AccountAccount(models.Model): _inherit = 'account.account' - _columns = { - 'centralized': fields.boolean( - 'Centralized', - help="If flagged, no details will be displayed in " - "the General Ledger report (the webkit one only), " - "only centralized amounts per period."), - } - - _defaults = { - 'centralized': False, - } + centralized = fields.Boolean( + 'Centralized', default=False, + help="If flagged, no details will be displayed in " + "the General Ledger report (the webkit one only), " + "only centralized amounts per period." + ) diff --git a/account_financial_report_webkit/report/aged_open_invoices.py b/account_financial_report_webkit/report/aged_open_invoices.py index 96c78374..f8fb8df6 100644 --- a/account_financial_report_webkit/report/aged_open_invoices.py +++ b/account_financial_report_webkit/report/aged_open_invoices.py @@ -71,6 +71,7 @@ class AccountAgedOpenInvoicesWebkit(PartnersOpenInvoicesWebkit): """Compute Aged Open Invoices based on result of Open Invoices""" + # pylint: disable=old-api7-method-defined def __init__(self, cursor, uid, name, context=None): """Constructor, refer to :class:`openerp.report.report_sxw.rml_parse`""" diff --git a/account_financial_report_webkit/report/aged_partner_balance.py b/account_financial_report_webkit/report/aged_partner_balance.py index a9de9ca9..54c59c7d 100644 --- a/account_financial_report_webkit/report/aged_partner_balance.py +++ b/account_financial_report_webkit/report/aged_partner_balance.py @@ -69,6 +69,7 @@ class AccountAgedTrialBalanceWebkit(PartnersOpenInvoicesWebkit): """Compute Aged Partner Balance based on result of Open Invoices""" + # pylint: disable=old-api7-method-defined def __init__(self, cursor, uid, name, context=None): """Constructor, refer to :class:`openerp.report.report_sxw.rml_parse`""" diff --git a/account_financial_report_webkit/report/common_balance_reports.py b/account_financial_report_webkit/report/common_balance_reports.py index 2e09e6d3..0515c094 100644 --- a/account_financial_report_webkit/report/common_balance_reports.py +++ b/account_financial_report_webkit/report/common_balance_reports.py @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ############################################################################## # # Author: Guewen Baconnier diff --git a/account_financial_report_webkit/report/common_partner_balance_reports.py b/account_financial_report_webkit/report/common_partner_balance_reports.py index 5139ad5e..f64ff9fc 100644 --- a/account_financial_report_webkit/report/common_partner_balance_reports.py +++ b/account_financial_report_webkit/report/common_partner_balance_reports.py @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ############################################################################## # # Author: Guewen Baconnier diff --git a/account_financial_report_webkit/report/common_partner_reports.py b/account_financial_report_webkit/report/common_partner_reports.py index 55ce8efd..ced7cf22 100644 --- a/account_financial_report_webkit/report/common_partner_reports.py +++ b/account_financial_report_webkit/report/common_partner_reports.py @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ############################################################################## # # Author: Nicolas Bessi, Guewen Baconnier diff --git a/account_financial_report_webkit/report/common_reports.py b/account_financial_report_webkit/report/common_reports.py index 7bbefe3d..45a15229 100644 --- a/account_financial_report_webkit/report/common_reports.py +++ b/account_financial_report_webkit/report/common_reports.py @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ############################################################################## # # Author: Nicolas Bessi, Guewen Baconnier @@ -24,7 +24,7 @@ import logging -from openerp.osv import osv +from openerp.exceptions import except_orm from openerp.tools.translate import _ from openerp.addons.account.report.common_report_header \ import common_report_header @@ -361,7 +361,7 @@ class CommonReportHeaderWebkit(common_report_header): limit=1, order='date_start %s' % (order,)) if not p_id: - raise osv.except_osv(_('No period found'), '') + raise except_orm(_('No period found'), '') return period_obj.browse(self.cursor, self.uid, p_id[0]) ############################### @@ -404,7 +404,7 @@ class CommonReportHeaderWebkit(common_report_header): opening_period_selected = self.get_included_opening_period( start_period) if not opening_period_selected: - raise osv.except_osv( + raise except_orm( _('Error'), _('No opening period found to compute the opening balances.\n' 'You have to configure a period on the first of January' @@ -490,7 +490,7 @@ class CommonReportHeaderWebkit(common_report_header): target_move, mode='include_opening'): """Get account move lines base on form data""" if mode not in ('include_opening', 'exclude_opening'): - raise osv.except_osv( + raise except_orm( _('Invalid query mode'), _('Must be in include_opening, exclude_opening')) @@ -502,7 +502,7 @@ class CommonReportHeaderWebkit(common_report_header): return self._get_move_ids_from_dates(account_id, start, stop, target_move) else: - raise osv.except_osv( + raise except_orm( _('No valid filter'), _('Please set a valid time filter')) def _get_move_line_datas(self, move_line_ids, diff --git a/account_financial_report_webkit/report/general_ledger.py b/account_financial_report_webkit/report/general_ledger.py index b91273c8..dcebd263 100644 --- a/account_financial_report_webkit/report/general_ledger.py +++ b/account_financial_report_webkit/report/general_ledger.py @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ############################################################################## # # Author: Nicolas Bessi, Guewen Baconnier @@ -32,6 +32,7 @@ from .webkit_parser_header_fix import HeaderFooterTextWebKitParser class GeneralLedgerWebkit(report_sxw.rml_parse, CommonReportHeaderWebkit): + # pylint: disable=old-api7-method-defined def __init__(self, cursor, uid, name, context): super(GeneralLedgerWebkit, self).__init__( cursor, uid, name, context=context) diff --git a/account_financial_report_webkit/report/open_invoices.py b/account_financial_report_webkit/report/open_invoices.py index 07fd92e7..5e04f986 100644 --- a/account_financial_report_webkit/report/open_invoices.py +++ b/account_financial_report_webkit/report/open_invoices.py @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ############################################################################## # # Author: Nicolas Bessi, Guewen Baconnier @@ -27,7 +27,7 @@ from mako.template import Template from openerp.modules.registry import RegistryManager -from openerp.osv import osv +from openerp.exceptions import except_orm from openerp.report import report_sxw from openerp.tools.translate import _ from openerp.addons.report_webkit import report_helper @@ -46,7 +46,7 @@ report_helper.WebKitHelper.get_mako_template = get_mako_template class PartnersOpenInvoicesWebkit(report_sxw.rml_parse, CommonPartnersReportHeaderWebkit): - + # pylint: disable=old-api7-method-defined def __init__(self, cursor, uid, name, context): super(PartnersOpenInvoicesWebkit, self).__init__( cursor, uid, name, context=context) @@ -134,7 +134,7 @@ class PartnersOpenInvoicesWebkit(report_sxw.rml_parse, new_ids, exclude_type=['view'], only_type=filter_type) if not account_ids: - raise osv.except_osv(_('Error'), _('No accounts to print.')) + raise except_orm(_('Error'), _('No accounts to print.')) # computation of ledeger lines if main_filter == 'filter_date': @@ -210,9 +210,9 @@ class PartnersOpenInvoicesWebkit(report_sxw.rml_parse, date_until_match = (stop == date_until) else: - raise osv.except_osv(_('Unsuported filter'), - _('Filter has to be in filter date, period, \ - or none')) + raise except_orm( + _('Unsuported filter'), + _('Filter has to be in filter date, period, or none')) initial_move_lines_per_account = {} if main_filter in ('filter_period', 'filter_no'): diff --git a/account_financial_report_webkit/report/partner_balance.py b/account_financial_report_webkit/report/partner_balance.py index 95a2787d..eb304ca3 100644 --- a/account_financial_report_webkit/report/partner_balance.py +++ b/account_financial_report_webkit/report/partner_balance.py @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ############################################################################## # # Author: Guewen Baconnier @@ -32,7 +32,7 @@ from .webkit_parser_header_fix import HeaderFooterTextWebKitParser class PartnerBalanceWebkit(report_sxw.rml_parse, CommonPartnerBalanceReportHeaderWebkit): - + # pylint: disable=old-api7-method-defined def __init__(self, cursor, uid, name, context): super(PartnerBalanceWebkit, self).__init__( cursor, uid, name, context=context) diff --git a/account_financial_report_webkit/report/partners_ledger.py b/account_financial_report_webkit/report/partners_ledger.py index 7ddca6b5..190ee519 100644 --- a/account_financial_report_webkit/report/partners_ledger.py +++ b/account_financial_report_webkit/report/partners_ledger.py @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ############################################################################## # # Author: Nicolas Bessi, Guewen Baconnier @@ -23,7 +23,7 @@ from collections import defaultdict from datetime import datetime from openerp.modules.registry import RegistryManager -from openerp.osv import osv +from openerp.exceptions import except_orm from openerp.report import report_sxw from openerp.tools.translate import _ from .common_partner_reports import CommonPartnersReportHeaderWebkit @@ -33,6 +33,7 @@ from .webkit_parser_header_fix import HeaderFooterTextWebKitParser class PartnersLedgerWebkit(report_sxw.rml_parse, CommonPartnersReportHeaderWebkit): + # pylint: disable=old-api7-method-defined def __init__(self, cursor, uid, name, context): super(PartnersLedgerWebkit, self).__init__( cursor, uid, name, context=context) @@ -116,7 +117,7 @@ class PartnersLedgerWebkit(report_sxw.rml_parse, only_type=filter_type) if not accounts: - raise osv.except_osv(_('Error'), _('No accounts to print.')) + raise except_orm(_('Error'), _('No accounts to print.')) if main_filter == 'filter_date': start = start_date diff --git a/account_financial_report_webkit/report/print_journal.py b/account_financial_report_webkit/report/print_journal.py index 3ef7d439..3876091e 100755 --- a/account_financial_report_webkit/report/print_journal.py +++ b/account_financial_report_webkit/report/print_journal.py @@ -34,6 +34,7 @@ from .webkit_parser_header_fix import HeaderFooterTextWebKitParser class PrintJournalWebkit(report_sxw.rml_parse, CommonReportHeaderWebkit): + # pylint: disable=old-api7-method-defined def __init__(self, cursor, uid, name, context): super(PrintJournalWebkit, self).__init__(cursor, uid, name, context=context) @@ -165,5 +166,3 @@ HeaderFooterTextWebKitParser( 'addons/account_financial_report_webkit/report/templates/\ account_report_print_journal.mako', parser=PrintJournalWebkit) - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/account_financial_report_webkit/report/trial_balance.py b/account_financial_report_webkit/report/trial_balance.py index 8c86659d..92f94d22 100644 --- a/account_financial_report_webkit/report/trial_balance.py +++ b/account_financial_report_webkit/report/trial_balance.py @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ############################################################################## # # Author: Guewen Baconnier @@ -36,6 +36,7 @@ def sign(number): class TrialBalanceWebkit(report_sxw.rml_parse, CommonBalanceReportHeaderWebkit): + # pylint: disable=old-api7-method-defined def __init__(self, cursor, uid, name, context): super(TrialBalanceWebkit, self).__init__(cursor, uid, name, context=context) diff --git a/account_financial_report_webkit/report/webkit_parser_header_fix.py b/account_financial_report_webkit/report/webkit_parser_header_fix.py index e2a45941..2766580d 100644 --- a/account_financial_report_webkit/report/webkit_parser_header_fix.py +++ b/account_financial_report_webkit/report/webkit_parser_header_fix.py @@ -38,7 +38,7 @@ from functools import partial from mako import exceptions -from openerp.osv.orm import except_orm +from openerp.exceptions import except_orm from openerp.tools.translate import _ from openerp.modules.registry import RegistryManager from openerp import tools @@ -182,6 +182,7 @@ class HeaderFooterTextWebKitParser(webkit_report.WebKitParser): return pdf # override needed to keep the attachments' storing procedure + # pylint: disable=old-api7-method-defined def create_single_pdf(self, cursor, uid, ids, data, report_xml, context=None): """generate the PDF""" diff --git a/account_financial_report_webkit/wizard/aged_open_invoices_wizard.py b/account_financial_report_webkit/wizard/aged_open_invoices_wizard.py index 3eb9f2fc..47cb38ed 100644 --- a/account_financial_report_webkit/wizard/aged_open_invoices_wizard.py +++ b/account_financial_report_webkit/wizard/aged_open_invoices_wizard.py @@ -19,24 +19,23 @@ # along with this program. If not, see . # ############################################################################## +from openerp import models, fields -from openerp.osv import orm - -class AgedOpenInvoice(orm.TransientModel): +class AgedOpenInvoice(models.TransientModel): """Will launch age partner balance report. This report is based on Open Invoice Report and share a lot of knowledge with him """ + # pylint: disable=consider-merging-classes-inherited _inherit = "open.invoices.webkit" _name = "aged.open.invoices.webkit" _description = "Aged open invoices" - _defaults = { - 'filter': 'filter_date', - } + filter = fields.Selection(default='filter_date') + # pylint: disable=old-api7-method-defined def onchange_fiscalyear(self, cr, uid, ids, fiscalyear=False, period_id=False, date_to=False, until_date=False, context=None): @@ -53,6 +52,7 @@ class AgedOpenInvoice(orm.TransientModel): }) return res + # pylint: disable=old-api7-method-defined def _print_report(self, cr, uid, ids, data, context=None): # we update form with display account value data = self.pre_print_report(cr, uid, ids, data, context=context) diff --git a/account_financial_report_webkit/wizard/aged_open_invoices_wizard.xml b/account_financial_report_webkit/wizard/aged_open_invoices_wizard.xml index 7f9b2f16..720bc975 100644 --- a/account_financial_report_webkit/wizard/aged_open_invoices_wizard.xml +++ b/account_financial_report_webkit/wizard/aged_open_invoices_wizard.xml @@ -5,6 +5,7 @@ Aged Open Invoice Report aged.open.invoices.webkit + 99 diff --git a/account_financial_report_webkit/wizard/aged_partner_balance_wizard.py b/account_financial_report_webkit/wizard/aged_partner_balance_wizard.py index 3bce5792..471812e8 100644 --- a/account_financial_report_webkit/wizard/aged_partner_balance_wizard.py +++ b/account_financial_report_webkit/wizard/aged_partner_balance_wizard.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- # Copyright 2014 Camptocamp SA, Nicolas Bessi. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp.osv import orm, fields +from openerp import models, fields -class AccountAgedTrialBalance(orm.TransientModel): +class AccountAgedTrialBalance(models.TransientModel): """Will launch age partner balance report. This report is based on Open Invoice Report and share a lot of knowledge with him @@ -14,27 +14,21 @@ class AccountAgedTrialBalance(orm.TransientModel): _name = "account.aged.trial.balance.webkit" _description = "Aged partner balanced" + # pylint: disable=old-api7-method-defined def _get_current_fiscalyear(self, cr, uid, context=None): return self.pool['account.fiscalyear'].find(cr, uid, context=context) - _columns = { - 'filter': fields.selection( - [('filter_period', 'Periods')], - "Filter by", - required=True), - 'fiscalyear_id': fields.many2one( - 'account.fiscalyear', - 'Fiscal Year', - required=True), - 'period_to': fields.many2one('account.period', 'End Period', - required=True), - } - - _defaults = { - 'filter': 'filter_period', - 'fiscalyear_id': _get_current_fiscalyear, - } - + filter = fields.Selection( + [('filter_period', 'Periods')], "Filter by", required=True, + default='filter_period' + ) + fiscalyear_id = fields.Many2one( + 'account.fiscalyear', 'Fiscal Year', required=True, + default=lambda self: self._get_current_fiscalyear() + ) + period_to = fields.Many2one('account.period', 'End Period', required=True) + + # pylint: disable=old-api7-method-defined def onchange_fiscalyear(self, cr, uid, ids, fiscalyear=False, period_id=False, date_to=False, until_date=False, context=None): @@ -51,6 +45,7 @@ class AccountAgedTrialBalance(orm.TransientModel): }) return res + # pylint: disable=old-api7-method-defined def _print_report(self, cr, uid, ids, data, context=None): # we update form with display account value data = self.pre_print_report(cr, uid, ids, data, context=context) diff --git a/account_financial_report_webkit/wizard/aged_partner_balance_wizard.xml b/account_financial_report_webkit/wizard/aged_partner_balance_wizard.xml index 7d19e28c..32dc6825 100644 --- a/account_financial_report_webkit/wizard/aged_partner_balance_wizard.xml +++ b/account_financial_report_webkit/wizard/aged_partner_balance_wizard.xml @@ -5,6 +5,7 @@ Aged Partner Balance Report account.aged.trial.balance.webkit + 99 diff --git a/account_financial_report_webkit/wizard/balance_common.py b/account_financial_report_webkit/wizard/balance_common.py index 591c8799..39dc638f 100644 --- a/account_financial_report_webkit/wizard/balance_common.py +++ b/account_financial_report_webkit/wizard/balance_common.py @@ -32,8 +32,10 @@ import time from lxml import etree from datetime import datetime -from openerp.osv import fields, orm +from openerp import fields, models from openerp.tools.translate import _ +# pylint: disable=deprecated-module +from openerp.osv.orm import setup_modifiers def previous_year_date(date, nb_prev=1): @@ -46,10 +48,11 @@ def previous_year_date(date, nb_prev=1): return previous_date -class AccountBalanceCommonWizard(orm.TransientModel): +class AccountBalanceCommonWizard(models.TransientModel): """Will launch trial balance report and pass required args""" + # pylint: disable=consider-merging-classes-inherited _inherit = "account.common.account.report" _name = "account.common.balance.report" _description = "Common Balance Report" @@ -74,6 +77,7 @@ class AccountBalanceCommonWizard(orm.TransientModel): for index in range(COMPARISON_LEVEL)] DYNAMIC_FIELDS = M2O_DYNAMIC_FIELDS + SIMPLE_DYNAMIC_FIELDS + # pylint: disable=old-api7-method-defined def _get_account_ids(self, cr, uid, context=None): res = False if context.get('active_model', False) == 'account.account' \ @@ -81,48 +85,47 @@ class AccountBalanceCommonWizard(orm.TransientModel): res = context['active_ids'] return res - _columns = { - 'account_ids': fields.many2many( - 'account.account', string='Filter on accounts', - help="Only selected accounts will be printed. Leave empty to \ - print all accounts."), - 'filter': fields.selection( - [('filter_no', 'No Filters'), - ('filter_date', 'Date'), - ('filter_period', 'Periods'), - ('filter_opening', 'Opening Only')], - "Filter by", - required=True, - help='Filter by date: no opening balance will be displayed. ' - '(opening balance can only be computed based on period to be \ - correct).'), - # Set statically because of the impossibility of changing the selection - # field when changing chart_account_id - 'account_level': fields.selection( - [('1', '1'), ('2', '2'), ('3', '3'), ('4', '4'), ('5', '5'), - ('6', '6')], string="Account level"), - } - + account_ids = fields.Many2many( + 'account.account', string='Filter on accounts', + help="Only selected accounts will be printed. Leave empty to \ + print all accounts.", default=lambda self: self._get_account_ids(), + ) + filter = fields.Selection( + [('filter_no', 'No Filters'), + ('filter_date', 'Date'), + ('filter_period', 'Periods'), + ('filter_opening', 'Opening Only')], + "Filter by", required=True, + help='Filter by date: no opening balance will be displayed. ' + '(opening balance can only be computed based on period to be \ + correct).' + ) + # Set statically because of the impossibility of changing the selection + # field when changing chart_account_id + account_level = fields.Selection( + [('1', '1'), ('2', '2'), ('3', '3'), ('4', '4'), ('5', '5'), + ('6', '6')], string="Account level" + ) + + # pylint: disable=attribute-deprecated + _columns = {} for index in range(COMPARISON_LEVEL): _columns.update( {"comp%s_filter" % index: - fields.selection( + fields.fields.selection( COMPARE_SELECTION, string='Compare By', required=True), "comp%s_fiscalyear_id" % index: - fields.many2one('account.fiscalyear', 'Fiscal Year'), + fields.fields.many2one('account.fiscalyear', 'Fiscal Year'), "comp%s_period_from" % index: - fields.many2one('account.period', 'Start Period'), + fields.fields.many2one('account.period', 'Start Period'), "comp%s_period_to" % index: - fields.many2one('account.period', 'End Period'), + fields.fields.many2one('account.period', 'End Period'), "comp%s_date_from" % index: - fields.date("Start Date"), + fields.fields.date("Start Date"), "comp%s_date_to" % index: - fields.date("End Date")}) - - _defaults = { - 'account_ids': _get_account_ids, - } + fields.fields.date("End Date")}) + # pylint: disable=old-api7-method-defined def _check_fiscalyear(self, cr, uid, ids, context=None): obj = self.read( cr, uid, ids[0], ['fiscalyear_id', 'filter'], context=context) @@ -136,6 +139,7 @@ class AccountBalanceCommonWizard(orm.TransientModel): periods or by date.', ['filter']), ] + # pylint: disable=old-api7-method-defined def default_get(self, cr, uid, fields, context=None): """ To get default values for the object. @@ -157,6 +161,7 @@ class AccountBalanceCommonWizard(orm.TransientModel): res[field] = 'filter_no' return res + # pylint: disable=old-api7-method-defined def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): res = super(AccountBalanceCommonWizard, self).fields_view_get( @@ -180,7 +185,7 @@ class AccountBalanceCommonWizard(orm.TransientModel): page.append(group) def modifiers_and_append(elem): - orm.setup_modifiers(elem) + setup_modifiers(elem) group.append(elem) modifiers_and_append(etree.Element( @@ -244,6 +249,7 @@ class AccountBalanceCommonWizard(orm.TransientModel): res['arch'] = etree.tostring(eview) return res + # pylint: disable=old-api7-method-defined def onchange_filter(self, cr, uid, ids, filter='filter_no', fiscalyear_id=False, context=None): res = {} @@ -296,6 +302,7 @@ class AccountBalanceCommonWizard(orm.TransientModel): end_period, 'date_from': False, 'date_to': False} return res + # pylint: disable=old-api7-method-defined def onchange_comp_filter(self, cr, uid, ids, index, main_filter='filter_no', comp_filter='filter_no', fiscalyear_id=False, start_date=False, @@ -390,6 +397,7 @@ class AccountBalanceCommonWizard(orm.TransientModel): date_to_field: False} return res + # pylint: disable=old-api7-method-defined def pre_print_report(self, cr, uid, ids, data, context=None): data = super(AccountBalanceCommonWizard, self).pre_print_report( cr, uid, ids, data, context=context) diff --git a/account_financial_report_webkit/wizard/general_ledger_wizard.py b/account_financial_report_webkit/wizard/general_ledger_wizard.py index b820a9ad..25fe206c 100644 --- a/account_financial_report_webkit/wizard/general_ledger_wizard.py +++ b/account_financial_report_webkit/wizard/general_ledger_wizard.py @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ############################################################################## # # Author: Nicolas Bessi, Guewen Baconnier @@ -20,11 +20,10 @@ ############################################################################## import time +from openerp import models, fields -from openerp.osv import fields, orm - -class AccountReportGeneralLedgerWizard(orm.TransientModel): +class AccountReportGeneralLedgerWizard(models.TransientModel): """Will launch general ledger report and pass required args""" @@ -32,6 +31,7 @@ class AccountReportGeneralLedgerWizard(orm.TransientModel): _name = "general.ledger.webkit" _description = "General Ledger Report" + # pylint: disable=old-api7-method-defined def _get_account_ids(self, cr, uid, context=None): res = False if context.get('active_model', False) == 'account.account' \ @@ -39,30 +39,27 @@ class AccountReportGeneralLedgerWizard(orm.TransientModel): res = context['active_ids'] return res - _columns = { - 'amount_currency': fields.boolean("With Currency", - help="It adds the currency column"), - - 'display_account': fields.selection( - [('bal_all', 'All'), - ('bal_mix', 'With transactions or non zero balance')], - 'Display accounts', - required=True), - 'account_ids': fields.many2many( - 'account.account', string='Filter on accounts', - help="""Only selected accounts will be printed. Leave empty to - print all accounts."""), - 'centralize': fields.boolean( - 'Activate Centralization', - help='Uncheck to display all the details of centralized accounts.') - } - _defaults = { - 'amount_currency': False, - 'display_account': 'bal_mix', - 'account_ids': _get_account_ids, - 'centralize': True, - } + amount_currency = fields.Boolean( + "With Currency", help="It adds the currency column", default=False, + ) + display_account = fields.Selection( + [ + ('bal_all', 'All'), + ('bal_mix', 'With transactions or non zero balance') + ], + 'Display accounts', required=True, default='bal_mix', + ) + account_ids = fields.Many2many( + 'account.account', string='Filter on accounts', + help="Only selected accounts will be printed. Leave empty to " + "print all accounts.", default=lambda self: self._get_account_ids(), + ) + centralize = fields.Boolean( + 'Activate Centralization', default=True, + help='Uncheck to display all the details of centralized accounts.', + ) + # pylint: disable=old-api7-method-defined def _check_fiscalyear(self, cr, uid, ids, context=None): obj = self.read( cr, uid, ids[0], ['fiscalyear_id', 'filter'], context=context) @@ -76,6 +73,7 @@ class AccountReportGeneralLedgerWizard(orm.TransientModel): periods or by date.', ['filter']), ] + # pylint: disable=old-api7-method-defined def pre_print_report(self, cr, uid, ids, data, context=None): data = super(AccountReportGeneralLedgerWizard, self).pre_print_report( cr, uid, ids, data, context=context) @@ -90,6 +88,7 @@ class AccountReportGeneralLedgerWizard(orm.TransientModel): data['form'].update(vals) return data + # pylint: disable=old-api7-method-defined def onchange_filter(self, cr, uid, ids, filter='filter_no', fiscalyear_id=False, context=None): res = {} @@ -148,6 +147,7 @@ class AccountReportGeneralLedgerWizard(orm.TransientModel): end_period, 'date_from': False, 'date_to': False} return res + # pylint: disable=old-api7-method-defined def _print_report(self, cursor, uid, ids, data, context=None): # we update form with display account value data = self.pre_print_report(cursor, uid, ids, data, context=context) diff --git a/account_financial_report_webkit/wizard/general_ledger_wizard_view.xml b/account_financial_report_webkit/wizard/general_ledger_wizard_view.xml index 982de98c..dc861bca 100644 --- a/account_financial_report_webkit/wizard/general_ledger_wizard_view.xml +++ b/account_financial_report_webkit/wizard/general_ledger_wizard_view.xml @@ -5,6 +5,7 @@ General Ledger general.ledger.webkit + 99 diff --git a/account_financial_report_webkit/wizard/open_invoices_wizard.py b/account_financial_report_webkit/wizard/open_invoices_wizard.py index 5ba70cc8..b19abce2 100644 --- a/account_financial_report_webkit/wizard/open_invoices_wizard.py +++ b/account_financial_report_webkit/wizard/open_invoices_wizard.py @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ############################################################################## # # Author: Guewen Baconnier @@ -18,10 +18,10 @@ # along with this program. If not, see . # ############################################################################## -from openerp.osv import fields, orm +from openerp import models, fields -class AccountReportOpenInvoicesWizard(orm.TransientModel): +class AccountReportOpenInvoicesWizard(models.TransientModel): """Will launch partner ledger report and pass required args""" @@ -29,13 +29,11 @@ class AccountReportOpenInvoicesWizard(orm.TransientModel): _name = "open.invoices.webkit" _description = "Open Invoices Report" - _columns = { - 'group_by_currency': fields.boolean('Group Partner by currency'), - 'until_date': fields.date( - "Clearance date", - required=True, - help="""The clearance date is essentially a tool used for debtors - provisionning calculation. + group_by_currency = fields.Boolean('Group Partner by currency') + until_date = fields.Date( + "Clearance date", required=True, + help="""The clearance date is essentially a tool used for debtors +provisionning calculation. By default, this date is equal to the the end date (ie: 31/12/2011 if you select fy 2011). @@ -43,8 +41,9 @@ select fy 2011). By amending the clearance date, you will be, for instance, able to answer the question : 'based on my last year end debtors open invoices, which invoices are still unpaid today (today is my clearance date)?' -""")} +""") + # pylint: disable=old-api7-method-defined def _check_until_date(self, cr, uid, ids, context=None): def get_key_id(obj, field): return obj.get(field) and obj[field][0] or False @@ -66,6 +65,7 @@ are still unpaid today (today is my clearance date)?' last period or later.', ['until_date']), ] + # pylint: disable=old-api7-method-defined def default_until_date(self, cr, uid, ids, fiscalyear_id=False, period_id=False, date_to=False, context=None): res_date = False @@ -82,6 +82,7 @@ are still unpaid today (today is my clearance date)?' context=context)['date_stop'] return res_date + # pylint: disable=old-api7-method-defined def onchange_fiscalyear(self, cr, uid, ids, fiscalyear=False, period_id=False, date_to=False, until_date=False, context=None): @@ -94,6 +95,7 @@ are still unpaid today (today is my clearance date)?' context=context) return res + # pylint: disable=old-api7-method-defined def onchange_date_to(self, cr, uid, ids, fiscalyear=False, period_id=False, date_to=False, until_date=False, context=None): res = {'value': {}} @@ -105,6 +107,7 @@ are still unpaid today (today is my clearance date)?' context=context) return res + # pylint: disable=old-api7-method-defined def onchange_period_to(self, cr, uid, ids, fiscalyear=False, period_id=False, date_to=False, until_date=False, context=None): @@ -117,6 +120,7 @@ are still unpaid today (today is my clearance date)?' context=context) return res + # pylint: disable=old-api7-method-defined def onchange_filter(self, cr, uid, ids, filter='filter_no', fiscalyear_id=False, context=None): res = super(AccountReportOpenInvoicesWizard, self).onchange_filter( @@ -131,6 +135,7 @@ are still unpaid today (today is my clearance date)?' context=context) return res + # pylint: disable=old-api7-method-defined def pre_print_report(self, cr, uid, ids, data, context=None): data = super(AccountReportOpenInvoicesWizard, self).pre_print_report( cr, uid, ids, data, context=context) @@ -140,6 +145,7 @@ are still unpaid today (today is my clearance date)?' data['form'].update(vals) return data + # pylint: disable=old-api7-method-defined def _print_report(self, cr, uid, ids, data, context=None): # we update form with display account value data = self.pre_print_report(cr, uid, ids, data, context=context) diff --git a/account_financial_report_webkit/wizard/open_invoices_wizard_view.xml b/account_financial_report_webkit/wizard/open_invoices_wizard_view.xml index 9989a8f0..d36fa64c 100644 --- a/account_financial_report_webkit/wizard/open_invoices_wizard_view.xml +++ b/account_financial_report_webkit/wizard/open_invoices_wizard_view.xml @@ -5,6 +5,7 @@ Open Invoices Report open.invoices.webkit + 99 diff --git a/account_financial_report_webkit/wizard/partner_balance_wizard.py b/account_financial_report_webkit/wizard/partner_balance_wizard.py index cec955b8..a36a8e22 100644 --- a/account_financial_report_webkit/wizard/partner_balance_wizard.py +++ b/account_financial_report_webkit/wizard/partner_balance_wizard.py @@ -9,6 +9,7 @@ class AccountPartnerBalanceWizard(models.TransientModel): """Will launch partner balance report and pass required args""" + # pylint: disable=consider-merging-classes-inherited _inherit = "account.common.balance.report" _name = "partner.balance.webkit" _description = "Partner Balance Report" diff --git a/account_financial_report_webkit/wizard/partner_balance_wizard_view.xml b/account_financial_report_webkit/wizard/partner_balance_wizard_view.xml index e7b9e2b0..49431b53 100644 --- a/account_financial_report_webkit/wizard/partner_balance_wizard_view.xml +++ b/account_financial_report_webkit/wizard/partner_balance_wizard_view.xml @@ -9,6 +9,7 @@ Partner Balance partner.balance.webkit + 99 diff --git a/account_financial_report_webkit/wizard/partners_ledger_wizard.py b/account_financial_report_webkit/wizard/partners_ledger_wizard.py index d384b6b0..e92f2f32 100644 --- a/account_financial_report_webkit/wizard/partners_ledger_wizard.py +++ b/account_financial_report_webkit/wizard/partners_ledger_wizard.py @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ############################################################################## # # Author: Nicolas Bessi, Guewen Baconnier @@ -19,11 +19,10 @@ # ############################################################################## import time +from openerp import models, fields -from openerp.osv import fields, orm - -class AccountReportPartnersLedgerWizard(orm.TransientModel): +class AccountReportPartnersLedgerWizard(models.TransientModel): """Will launch partner ledger report and pass required args""" @@ -31,27 +30,25 @@ class AccountReportPartnersLedgerWizard(orm.TransientModel): _name = "partners.ledger.webkit" _description = "Partner Ledger Report" - _columns = { - 'amount_currency': fields.boolean("With Currency", - help="It adds the currency column"), - 'partner_ids': fields.many2many( - 'res.partner', - string='Filter on partner', - help="Only selected partners will be printed. " - "Leave empty to print all partners."), - 'filter': fields.selection( - [('filter_no', 'No Filters'), - ('filter_date', 'Date'), - ('filter_period', 'Periods')], "Filter by", required=True, - help='Filter by date: no opening balance will be displayed. ' - '(opening balance can only be computed based on period to be \ - correct).'), - } - _defaults = { - 'amount_currency': False, - 'result_selection': 'customer_supplier', - } + amount_currency = fields.Boolean( + "With Currency", help="It adds the currency column", default=False, + ) + partner_ids = fields.Many2many( + 'res.partner', string='Filter on partner', + help="Only selected partners will be printed. Leave empty to print " + "all partners." + ) + filter = fields.Selection( + [('filter_no', 'No Filters'), + ('filter_date', 'Date'), + ('filter_period', 'Periods')], "Filter by", required=True, + help='Filter by date: no opening balance will be displayed. ' + '(opening balance can only be computed based on period to be ' + 'correct).', + ) + result_selection = fields.Selection(default='customer_supplier') + # pylint: disable=old-api7-method-defined def _check_fiscalyear(self, cr, uid, ids, context=None): obj = self.read( cr, uid, ids[0], ['fiscalyear_id', 'filter'], context=context) @@ -66,6 +63,7 @@ class AccountReportPartnersLedgerWizard(orm.TransientModel): ['filter']), ] + # pylint: disable=old-api7-method-defined def onchange_filter(self, cr, uid, ids, filter='filter_no', fiscalyear_id=False, context=None): res = {} @@ -119,6 +117,7 @@ class AccountReportPartnersLedgerWizard(orm.TransientModel): end_period, 'date_from': False, 'date_to': False} return res + # pylint: disable=old-api7-method-defined def pre_print_report(self, cr, uid, ids, data, context=None): data = super(AccountReportPartnersLedgerWizard, self).pre_print_report( cr, uid, ids, data, context=context) @@ -132,6 +131,7 @@ class AccountReportPartnersLedgerWizard(orm.TransientModel): data['form'].update(vals) return data + # pylint: disable=old-api7-method-defined def _print_report(self, cursor, uid, ids, data, context=None): # we update form with display account value data = self.pre_print_report(cursor, uid, ids, data, context=context) diff --git a/account_financial_report_webkit/wizard/partners_ledger_wizard_view.xml b/account_financial_report_webkit/wizard/partners_ledger_wizard_view.xml index 102926b6..38af6acb 100644 --- a/account_financial_report_webkit/wizard/partners_ledger_wizard_view.xml +++ b/account_financial_report_webkit/wizard/partners_ledger_wizard_view.xml @@ -5,6 +5,7 @@ Partner Ledger partners.ledger.webkit + 99 diff --git a/account_financial_report_webkit/wizard/print_journal.py b/account_financial_report_webkit/wizard/print_journal.py index 1f23fb8e..07c1540d 100644 --- a/account_financial_report_webkit/wizard/print_journal.py +++ b/account_financial_report_webkit/wizard/print_journal.py @@ -21,30 +21,25 @@ # along with this program. If not, see . # ############################################################################## - -from openerp.osv import fields, orm +from openerp import models, fields import time -class AccountReportPrintJournalWizard(orm.TransientModel): +class AccountReportPrintJournalWizard(models.TransientModel): """Will launch print journal report and pass requiered args""" + # pylint: disable=consider-merging-classes-inherited _inherit = "account.common.account.report" _name = "print.journal.webkit" _description = "Journals Report" - _columns = { - 'amount_currency': fields.boolean("With Currency", - help="It adds the currency column"), - } - - _defaults = { - 'amount_currency': False, - 'journal_ids': False, - 'filter': 'filter_period', - } + amount_currency = fields.Boolean( + "With Currency", default=False, help="It adds the currency column", + ) + filter = fields.Selection(default='filter_period') + # pylint: disable=old-api7-method-defined def _check_fiscalyear(self, cr, uid, ids, context=None): obj = self.read(cr, uid, ids[0], ['fiscalyear_id', 'filter'], context=context) @@ -57,6 +52,7 @@ class AccountReportPrintJournalWizard(orm.TransientModel): to filter by periods or by date.', ['filter']), ] + # pylint: disable=old-api7-method-defined def pre_print_report(self, cr, uid, ids, data, context=None): data = super(AccountReportPrintJournalWizard, self).\ pre_print_report(cr, uid, ids, data, context=context) @@ -70,6 +66,7 @@ class AccountReportPrintJournalWizard(orm.TransientModel): data['form'].update(vals) return data + # pylint: disable=old-api7-method-defined def onchange_filter(self, cr, uid, ids, filter='filter_no', fiscalyear_id=False, context=None): res = {} @@ -122,6 +119,7 @@ class AccountReportPrintJournalWizard(orm.TransientModel): end_period, 'date_from': False, 'date_to': False} return res + # pylint: disable=old-api7-method-defined def _print_report(self, cursor, uid, ids, data, context=None): context = context or {} # we update form with display account value diff --git a/account_financial_report_webkit/wizard/print_journal_view.xml b/account_financial_report_webkit/wizard/print_journal_view.xml index 2482927e..33e56207 100644 --- a/account_financial_report_webkit/wizard/print_journal_view.xml +++ b/account_financial_report_webkit/wizard/print_journal_view.xml @@ -28,6 +28,7 @@ Journals print.journal.webkit form + 99 diff --git a/account_financial_report_webkit/wizard/trial_balance_wizard.py b/account_financial_report_webkit/wizard/trial_balance_wizard.py index b34ce6c5..635d9623 100644 --- a/account_financial_report_webkit/wizard/trial_balance_wizard.py +++ b/account_financial_report_webkit/wizard/trial_balance_wizard.py @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ############################################################################## # # Author: Guewen Baconnier @@ -18,17 +18,17 @@ # along with this program. If not, see . # ############################################################################## +from openerp import models -from openerp.osv import orm - -class AccountTrialBalanceWizard(orm.TransientModel): +class AccountTrialBalanceWizard(models.TransientModel): """Will launch trial balance report and pass required args""" _inherit = "account.common.balance.report" _name = "trial.balance.webkit" _description = "Trial Balance Report" + # pylint: disable=old-api7-method-defined def _print_report(self, cursor, uid, ids, data, context=None): context = context or {} # we update form with display account value diff --git a/account_financial_report_webkit/wizard/trial_balance_wizard_view.xml b/account_financial_report_webkit/wizard/trial_balance_wizard_view.xml index 19d56efe..55a97c0c 100644 --- a/account_financial_report_webkit/wizard/trial_balance_wizard_view.xml +++ b/account_financial_report_webkit/wizard/trial_balance_wizard_view.xml @@ -9,6 +9,7 @@ Trial Balance trial.balance.webkit + 99 diff --git a/account_financial_report_webkit_xls/__openerp__.py b/account_financial_report_webkit_xls/__openerp__.py index eebbd67c..9fba30ce 100644 --- a/account_financial_report_webkit_xls/__openerp__.py +++ b/account_financial_report_webkit_xls/__openerp__.py @@ -23,6 +23,5 @@ 'test/trial_balance.yml', 'test/partner_balance.yml', 'test/open_invoices.yml'], - 'active': False, 'installable': True, } diff --git a/account_financial_report_webkit_xls/report/aged_open_invoices_xls.py b/account_financial_report_webkit_xls/report/aged_open_invoices_xls.py index dfc7f402..4b38556a 100644 --- a/account_financial_report_webkit_xls/report/aged_open_invoices_xls.py +++ b/account_financial_report_webkit_xls/report/aged_open_invoices_xls.py @@ -14,6 +14,7 @@ from openerp.tools.translate import _ class AccountAgedOpenInvoicesWebkitXls(report_xls): + # pylint: disable=old-api7-method-defined def create(self, cr, uid, ids, data, context=None): self._column_sizes = [ 30, # Partner diff --git a/account_financial_report_webkit_xls/report/aged_partner_balance_xls.py b/account_financial_report_webkit_xls/report/aged_partner_balance_xls.py index a7d16006..95a72312 100644 --- a/account_financial_report_webkit_xls/report/aged_partner_balance_xls.py +++ b/account_financial_report_webkit_xls/report/aged_partner_balance_xls.py @@ -13,6 +13,7 @@ from openerp.tools.translate import _ class AccountAgedTrialBalanceWebkitXls(report_xls): + # pylint: disable=old-api7-method-defined def create(self, cr, uid, ids, data, context=None): self._column_sizes = [ 30, # Partner diff --git a/account_financial_report_webkit_xls/report/general_ledger_xls.py b/account_financial_report_webkit_xls/report/general_ledger_xls.py index caebd35a..f8932735 100644 --- a/account_financial_report_webkit_xls/report/general_ledger_xls.py +++ b/account_financial_report_webkit_xls/report/general_ledger_xls.py @@ -29,7 +29,7 @@ _column_sizes = [ ] -class general_ledger_xls(report_xls): +class GeneralLedgerXls(report_xls): column_sizes = [x[1] for x in _column_sizes] def generate_xls_report(self, _p, _xs, data, objects, wb): @@ -327,6 +327,6 @@ class general_ledger_xls(report_xls): row_pos += 1 -general_ledger_xls('report.account.account_report_general_ledger_xls', - 'account.account', - parser=GeneralLedgerWebkit) +GeneralLedgerXls('report.account.account_report_general_ledger_xls', + 'account.account', + parser=GeneralLedgerWebkit) diff --git a/account_financial_report_webkit_xls/report/open_invoices_xls.py b/account_financial_report_webkit_xls/report/open_invoices_xls.py index c9aa9f36..2412bb30 100644 --- a/account_financial_report_webkit_xls/report/open_invoices_xls.py +++ b/account_financial_report_webkit_xls/report/open_invoices_xls.py @@ -12,7 +12,7 @@ from openerp.tools.translate import _ # _logger = logging.getLogger(__name__) -class open_invoices_xls(report_xls): +class OpenInvoicesXls(report_xls): column_sizes = [12, 12, 20, 15, 30, 30, 14, 14, 14, 14, 14, 14, 10] def global_initializations(self, wb, _p, xlwt, _xs, objects, data): @@ -806,5 +806,5 @@ class open_invoices_xls(report_xls): row_pos += 1 -open_invoices_xls('report.account.account_report_open_invoices_xls', - 'account.account', parser=PartnersOpenInvoicesWebkit) +OpenInvoicesXls('report.account.account_report_open_invoices_xls', + 'account.account', parser=PartnersOpenInvoicesWebkit) diff --git a/account_financial_report_webkit_xls/report/partner_ledger_xls.py b/account_financial_report_webkit_xls/report/partner_ledger_xls.py index 504fe2d0..5071a000 100644 --- a/account_financial_report_webkit_xls/report/partner_ledger_xls.py +++ b/account_financial_report_webkit_xls/report/partner_ledger_xls.py @@ -27,7 +27,7 @@ _column_sizes = [ ] -class partner_ledger_xls(report_xls): +class PartnerLedgerXls(report_xls): column_sizes = [x[1] for x in _column_sizes] def generate_xls_report(self, _p, _xs, data, objects, wb): @@ -438,6 +438,6 @@ class partner_ledger_xls(report_xls): row_pos += 2 -partner_ledger_xls('report.account.account_report_partner_ledger_xls', - 'account.account', - parser=PartnersLedgerWebkit) +PartnerLedgerXls('report.account.account_report_partner_ledger_xls', + 'account.account', + parser=PartnersLedgerWebkit) diff --git a/account_financial_report_webkit_xls/report/partners_balance_xls.py b/account_financial_report_webkit_xls/report/partners_balance_xls.py index b282b69b..2c0b1db3 100644 --- a/account_financial_report_webkit_xls/report/partners_balance_xls.py +++ b/account_financial_report_webkit_xls/report/partners_balance_xls.py @@ -15,7 +15,7 @@ def display_line(all_comparison_lines): return any([line.get('balance') for line in all_comparison_lines]) -class partners_balance_xls(report_xls): +class PartnersBalanceXls(report_xls): column_sizes = [12, 40, 25, 17, 17, 17, 17, 17] def print_title(self, ws, _p, row_position, xlwt, _xs): @@ -409,6 +409,6 @@ class partners_balance_xls(report_xls): _xs, xlwt, ws, row_account_start, row_pos, current_account, _p) -partners_balance_xls('report.account.account_report_partner_balance_xls', - 'account.account', - parser=PartnerBalanceWebkit) +PartnersBalanceXls('report.account.account_report_partner_balance_xls', + 'account.account', + parser=PartnerBalanceWebkit) diff --git a/account_financial_report_webkit_xls/report/trial_balance_xls.py b/account_financial_report_webkit_xls/report/trial_balance_xls.py index fde93c06..c6460382 100644 --- a/account_financial_report_webkit_xls/report/trial_balance_xls.py +++ b/account_financial_report_webkit_xls/report/trial_balance_xls.py @@ -13,6 +13,7 @@ from openerp.tools.translate import _ class TrialBalanceXls(report_xls): + # pylint: disable=old-api7-method-defined def create(self, cr, uid, ids, data, context=None): self._column_sizes = [12, 60, 17, 17, 17, 17, 17, 17] self._debit_pos = 4 diff --git a/account_financial_report_webkit_xls/wizard/aged_open_invoices_wizard.py b/account_financial_report_webkit_xls/wizard/aged_open_invoices_wizard.py index 563e1d37..5a2f675d 100644 --- a/account_financial_report_webkit_xls/wizard/aged_open_invoices_wizard.py +++ b/account_financial_report_webkit_xls/wizard/aged_open_invoices_wizard.py @@ -7,9 +7,11 @@ from openerp import models class AgedOpenInvoice(models.TransientModel): _inherit = 'aged.open.invoices.webkit' + # pylint: disable=old-api7-method-defined def xls_export(self, cr, uid, ids, context=None): return self.check_report(cr, uid, ids, context=context) + # pylint: disable=old-api7-method-defined def _print_report(self, cr, uid, ids, data, context=None): context = context or {} if context.get('xls_export'): diff --git a/account_financial_report_webkit_xls/wizard/aged_partner_balance_wizard.py b/account_financial_report_webkit_xls/wizard/aged_partner_balance_wizard.py index b70b23eb..63de571d 100644 --- a/account_financial_report_webkit_xls/wizard/aged_partner_balance_wizard.py +++ b/account_financial_report_webkit_xls/wizard/aged_partner_balance_wizard.py @@ -7,9 +7,11 @@ from openerp import models class AccountAgedTrialBalance(models.TransientModel): _inherit = 'account.aged.trial.balance.webkit' + # pylint: disable=old-api7-method-defined def xls_export(self, cr, uid, ids, context=None): return self.check_report(cr, uid, ids, context=context) + # pylint: disable=old-api7-method-defined def _print_report(self, cr, uid, ids, data, context=None): context = context or {} if context.get('xls_export'): diff --git a/account_financial_report_webkit_xls/wizard/general_ledger_wizard.py b/account_financial_report_webkit_xls/wizard/general_ledger_wizard.py index d0d394cc..a3766aa3 100644 --- a/account_financial_report_webkit_xls/wizard/general_ledger_wizard.py +++ b/account_financial_report_webkit_xls/wizard/general_ledger_wizard.py @@ -7,9 +7,11 @@ from openerp import models class AccountReportGeneralLedgerWizard(models.TransientModel): _inherit = 'general.ledger.webkit' + # pylint: disable=old-api7-method-defined def xls_export(self, cr, uid, ids, context=None): return self.check_report(cr, uid, ids, context=context) + # pylint: disable=old-api7-method-defined def _print_report(self, cr, uid, ids, data, context=None): context = context or {} if context.get('xls_export'): diff --git a/account_financial_report_webkit_xls/wizard/general_ledger_wizard_view.xml b/account_financial_report_webkit_xls/wizard/general_ledger_wizard_view.xml index dd6a53a7..1bffd05f 100644 --- a/account_financial_report_webkit_xls/wizard/general_ledger_wizard_view.xml +++ b/account_financial_report_webkit_xls/wizard/general_ledger_wizard_view.xml @@ -5,6 +5,7 @@ general.ledger.webkit.xls general.ledger.webkit + 99 form diff --git a/account_financial_report_webkit_xls/wizard/open_invoices_wizard.py b/account_financial_report_webkit_xls/wizard/open_invoices_wizard.py index 5b4b4df6..32dfd592 100644 --- a/account_financial_report_webkit_xls/wizard/open_invoices_wizard.py +++ b/account_financial_report_webkit_xls/wizard/open_invoices_wizard.py @@ -7,9 +7,11 @@ from openerp import models class AccountReportOpenInvoicesWizard(models.TransientModel): _inherit = 'open.invoices.webkit' + # pylint: disable=old-api7-method-defined def xls_export(self, cr, uid, ids, context=None): return self.check_report(cr, uid, ids, context=context) + # pylint: disable=old-api7-method-defined def _print_report(self, cr, uid, ids, data, context=None): context = context or {} if context.get('xls_export'): diff --git a/account_financial_report_webkit_xls/wizard/open_invoices_wizard_view.xml b/account_financial_report_webkit_xls/wizard/open_invoices_wizard_view.xml index 1430e727..e1b0e3ec 100644 --- a/account_financial_report_webkit_xls/wizard/open_invoices_wizard_view.xml +++ b/account_financial_report_webkit_xls/wizard/open_invoices_wizard_view.xml @@ -5,6 +5,7 @@ open.invoices.webkit.xls open.invoices.webkit + 99 form diff --git a/account_financial_report_webkit_xls/wizard/partners_balance_wizard.py b/account_financial_report_webkit_xls/wizard/partners_balance_wizard.py index 3c0d6faf..62a3a65e 100644 --- a/account_financial_report_webkit_xls/wizard/partners_balance_wizard.py +++ b/account_financial_report_webkit_xls/wizard/partners_balance_wizard.py @@ -7,9 +7,11 @@ from openerp import models class AccountPartnerBalanceWizard(models.TransientModel): _inherit = 'partner.balance.webkit' + # pylint: disable=old-api7-method-defined def xls_export(self, cr, uid, ids, context=None): return self.check_report(cr, uid, ids, context=context) + # pylint: disable=old-api7-method-defined def _print_report(self, cr, uid, ids, data, context=None): context = context or {} if context.get('xls_export'): diff --git a/account_financial_report_webkit_xls/wizard/partners_ledger_wizard.py b/account_financial_report_webkit_xls/wizard/partners_ledger_wizard.py index 450bbfab..8d514fcb 100644 --- a/account_financial_report_webkit_xls/wizard/partners_ledger_wizard.py +++ b/account_financial_report_webkit_xls/wizard/partners_ledger_wizard.py @@ -7,9 +7,11 @@ from openerp import models class AccountReportPartnersLedgerWizard(models.TransientModel): _inherit = 'partners.ledger.webkit' + # pylint: disable=old-api7-method-defined def xls_export(self, cr, uid, ids, context=None): return self.check_report(cr, uid, ids, context=context) + # pylint: disable=old-api7-method-defined def _print_report(self, cr, uid, ids, data, context=None): context = context or {} if context.get('xls_export'): diff --git a/account_financial_report_webkit_xls/wizard/partners_ledger_wizard_view.xml b/account_financial_report_webkit_xls/wizard/partners_ledger_wizard_view.xml index 86201acf..8f9976cc 100644 --- a/account_financial_report_webkit_xls/wizard/partners_ledger_wizard_view.xml +++ b/account_financial_report_webkit_xls/wizard/partners_ledger_wizard_view.xml @@ -5,6 +5,7 @@ partners.ledger.webkit.xls partners.ledger.webkit + 99 form diff --git a/account_financial_report_webkit_xls/wizard/trial_balance_wizard.py b/account_financial_report_webkit_xls/wizard/trial_balance_wizard.py index 77965ba1..5d6b1bd6 100644 --- a/account_financial_report_webkit_xls/wizard/trial_balance_wizard.py +++ b/account_financial_report_webkit_xls/wizard/trial_balance_wizard.py @@ -7,9 +7,11 @@ from openerp import models class AccountTrialBalanceWizard(models.TransientModel): _inherit = 'trial.balance.webkit' + # pylint: disable=old-api7-method-defined def xls_export(self, cr, uid, ids, context=None): return self.check_report(cr, uid, ids, context=context) + # pylint: disable=old-api7-method-defined def _print_report(self, cr, uid, ids, data, context=None): context = context or {} if context.get('xls_export'): diff --git a/account_financial_report_webkit_xls/wizard/trial_balance_wizard_view.xml b/account_financial_report_webkit_xls/wizard/trial_balance_wizard_view.xml index e2828c71..2fb2bd62 100644 --- a/account_financial_report_webkit_xls/wizard/trial_balance_wizard_view.xml +++ b/account_financial_report_webkit_xls/wizard/trial_balance_wizard_view.xml @@ -5,6 +5,7 @@ trial.balance.webkit.xls trial.balance.webkit + 99 form diff --git a/account_journal_report_xls/__openerp__.py b/account_journal_report_xls/__openerp__.py index 36057789..6666d83b 100644 --- a/account_journal_report_xls/__openerp__.py +++ b/account_journal_report_xls/__openerp__.py @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution diff --git a/account_journal_report_xls/account_journal.py b/account_journal_report_xls/account_journal.py index e426ec9d..bbb204ed 100644 --- a/account_journal_report_xls/account_journal.py +++ b/account_journal_report_xls/account_journal.py @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution @@ -19,14 +19,14 @@ # along with this program. If not, see . # ############################################################################## +from openerp import models -from openerp.osv import orm - -class account_journal(orm.Model): +class AccountJournal(models.Model): _inherit = 'account.journal' # allow inherited modules to extend the query + # pylint: disable=old-api7-method-defined def _report_xls_query_extra(self, cr, uid, context=None): select_extra = "" join_extra = "" @@ -34,10 +34,12 @@ class account_journal(orm.Model): return (select_extra, join_extra, where_extra) # allow inherited modules to add document references + # pylint: disable=old-api7-method-defined def _report_xls_document_extra(self, cr, uid, context): return "''" # override list in inherited module to add/drop columns or change order + # pylint: disable=old-api7-method-defined def _report_xls_fields(self, cr, uid, context=None): res = [ 'move_name', # account.move,name @@ -73,6 +75,7 @@ class account_journal(orm.Model): return res # Change/Add Template entries + # pylint: disable=old-api7-method-defined def _report_xls_template(self, cr, uid, context=None): """ Template updates, e.g. diff --git a/account_journal_report_xls/report/nov_account_journal.py b/account_journal_report_xls/report/nov_account_journal.py index bb8ed135..0ac14258 100644 --- a/account_journal_report_xls/report/nov_account_journal.py +++ b/account_journal_report_xls/report/nov_account_journal.py @@ -11,12 +11,12 @@ _logger = logging.getLogger(__name__) _ir_translation_name = 'nov.account.journal.print' -class nov_journal_print(report_sxw.rml_parse): +class NovJournalPrint(report_sxw.rml_parse): def set_context(self, objects, data, ids, report_type=None): # _logger.warn('set_context, objects = %s, data = %s, # ids = %s', objects, data, ids) - super(nov_journal_print, self).set_context(objects, data, ids) + super(NovJournalPrint, self).set_context(objects, data, ids) j_obj = self.pool.get('account.journal') p_obj = self.pool.get('account.period') fy_obj = self.pool.get('account.fiscalyear') @@ -48,10 +48,11 @@ class nov_journal_print(report_sxw.rml_parse): objects.append((journal, fiscalyear)) self.localcontext['objects'] = self.objects = objects + # pylint: disable=old-api7-method-defined def __init__(self, cr, uid, name, context): if context is None: context = {} - super(nov_journal_print, self).__init__(cr, uid, name, context=context) + super(NovJournalPrint, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, 'title': self._title, @@ -121,6 +122,7 @@ class nov_journal_print(report_sxw.rml_parse): # field value translations. # If performance is no issue, you can adapt the _report_xls_template in # an inherited module to add field value translations. + # pylint: disable=sql-injection self.cr.execute("SELECT l.move_id AS move_id, l.id AS aml_id, " "am.name AS move_name, " "coalesce(am.ref,'') AS move_ref, " @@ -197,8 +199,9 @@ class nov_journal_print(report_sxw.rml_parse): code_string = j_obj._report_xls_document_extra( self.cr, self.uid, self.context) # _logger.warn('code_string= %s', code_string) - # disable=W0123, safe_eval doesn't apply here since + # W0123, safe_eval doesn't apply here since # code_string comes from python module + # pylint: disable=eval-referenced [x.update( {'docname': eval(code_string) or '-'}) # pylint: disable=W0123 for x in lines] @@ -307,6 +310,7 @@ class nov_journal_print(report_sxw.rml_parse): else: fiscalyear = object[1] period_ids = [x.id for x in fiscalyear.period_ids] + # pylint: disable=sql-injection select = "SELECT sum(" + field + ") FROM account_move_line l " \ "INNER JOIN account_move am ON l.move_id = am.id " \ "WHERE l.period_id IN %s AND l.journal_id=%s AND am.state IN %s" @@ -334,7 +338,7 @@ class nov_journal_print(report_sxw.rml_parse): if isinstance(value, (float, int)) and not value: return '' else: - return super(nov_journal_print, self).formatLang( + return super(NovJournalPrint, self).formatLang( value, digits, date, date_time, grouping, monetary, dp, currency_obj) @@ -342,4 +346,4 @@ class nov_journal_print(report_sxw.rml_parse): report_sxw.report_sxw( 'report.nov.account.journal.print', 'account.journal', 'addons/account_journal_report_xls/report/nov_account_journal.rml', - parser=nov_journal_print, header=False) + parser=NovJournalPrint, header=False) diff --git a/account_journal_report_xls/report/nov_account_journal_xls.py b/account_journal_report_xls/report/nov_account_journal_xls.py index eab96259..c816ca76 100644 --- a/account_journal_report_xls/report/nov_account_journal_xls.py +++ b/account_journal_report_xls/report/nov_account_journal_xls.py @@ -4,20 +4,21 @@ import xlwt from datetime import datetime -from openerp.osv import orm from openerp.addons.report_xls.report_xls import report_xls from openerp.addons.report_xls.utils import rowcol_to_cell, _render from .nov_account_journal import nov_journal_print from openerp.tools.translate import _ +from openerp.exceptions import except_orm import logging _logger = logging.getLogger(__name__) -class account_journal_xls_parser(nov_journal_print): +class AccountJournalXlsParser(nov_journal_print): + # pylint: disable=old-api7-method-defined def __init__(self, cr, uid, name, context): - super(account_journal_xls_parser, self).__init__(cr, uid, name, - context=context) + super(AccountJournalXlsParser, self).__init__( + cr, uid, name, context=context) journal_obj = self.pool.get('account.journal') self.context = context wanted_list = journal_obj._report_xls_fields(cr, uid, context) @@ -29,11 +30,12 @@ class account_journal_xls_parser(nov_journal_print): }) -class account_journal_xls(report_xls): +class AccountJournalXls(report_xls): + # pylint: disable=old-api7-method-defined def __init__(self, name, table, rml=False, parser=False, header=True, store=False): - super(account_journal_xls, self).__init__( + super(AccountJournalXls, self).__init__( name, table, rml, parser, header, store) # Cell Styles @@ -305,7 +307,7 @@ class account_journal_xls(report_xls): cols_number = len(wanted_list) vat_summary_cols_number = len(vat_summary_wanted_list) if vat_summary_cols_number > cols_number: - raise orm.except_orm( + raise except_orm( _('Programming Error!'), _("vat_summary_cols_number should be < cols_number !")) index = 0 @@ -360,10 +362,12 @@ class account_journal_xls(report_xls): 'credit') if not (self.credit_pos and self.debit_pos) and 'balance' \ in wanted_list: - raise orm.except_orm(_('Customisation Error!'), - _("The 'Balance' field is a calculated XLS \ - field requiring the presence of the \ - 'Debit' and 'Credit' fields !")) + raise except_orm( + _('Customisation Error!'), + _("The 'Balance' field is a calculated XLS \ + field requiring the presence of the \ + 'Debit' and 'Credit' fields !") + ) for o in objects: @@ -387,5 +391,7 @@ class account_journal_xls(report_xls): row_pos = self._journal_vat_summary(o, ws, _p, row_pos, _xs) -account_journal_xls('report.nov.account.journal.xls', 'account.journal.period', - parser=account_journal_xls_parser) +AccountJournalXls( + 'report.nov.account.journal.xls', 'account.journal.period', + parser=AccountJournalXlsParser, +) diff --git a/account_journal_report_xls/wizard/print_journal_wizard.py b/account_journal_report_xls/wizard/print_journal_wizard.py index cc2ab4a2..e1390b22 100644 --- a/account_journal_report_xls/wizard/print_journal_wizard.py +++ b/account_journal_report_xls/wizard/print_journal_wizard.py @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution @@ -19,37 +19,34 @@ # along with this program. If not, see . # ############################################################################## - -from openerp.tools.translate import _ -from openerp.osv import orm, fields +from openerp import _, exceptions, models, fields from openerp.addons.account.wizard.account_report_common_journal \ import account_common_journal_report import logging _logger = logging.getLogger(__name__) -class account_print_journal_xls(orm.TransientModel): +class AccountPrintJournalXls(models.TransientModel): _inherit = 'account.print.journal' _name = 'account.print.journal.xls' _description = 'Print/Export Journal' - _columns = { - 'journal_ids': fields.many2many( - 'account.journal', - 'account_print_journal_xls_journal_rel', - 'journal_xls_id', - 'journal_id', - string='Journals', - required=True), - 'group_entries': fields.boolean( - 'Group Entries', - help="Group entries with same General Account & Tax Code."), - } - _defaults = { - 'group_entries': True, - } + journal_ids = fields.Many2many( + 'account.journal', + 'account_print_journal_xls_journal_rel', + 'journal_xls_id', + 'journal_id', + string='Journals', + required=True + ) + group_entries = fields.Boolean( + 'Group Entries', default=True, + help="Group entries with same General Account & Tax Code." + ) + + # pylint: disable=old-api7-method-defined def fields_get(self, cr, uid, fields=None, context=None): - res = super(account_print_journal_xls, self).fields_get( + res = super(AccountPrintJournalXls, self).fields_get( cr, uid, fields, context) if context.get('print_by') == 'fiscalyear': if 'fiscalyear_id' in res: @@ -65,6 +62,7 @@ class account_print_journal_xls(orm.TransientModel): res['period_to']['required'] = True return res + # pylint: disable=old-api7-method-defined def fy_period_ids(self, cr, uid, fiscalyear_id): """ returns all periods from a fiscalyear sorted by date """ fy_period_ids = [] @@ -78,6 +76,7 @@ class account_print_journal_xls(orm.TransientModel): fy_period_ids = [x[0] for x in res] return fy_period_ids + # pylint: disable=old-api7-method-defined def onchange_fiscalyear_id(self, cr, uid, ids, fiscalyear_id=False, context=None): res = {'value': {}} @@ -89,6 +88,7 @@ class account_print_journal_xls(orm.TransientModel): res['value']['period_to'] = fy_period_ids[-1] return res + # pylint: disable=old-api7-method-defined def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): """ skip account.common.journal.report,fields_view_get @@ -97,9 +97,11 @@ class account_print_journal_xls(orm.TransientModel): fields_view_get(cr, uid, view_id, view_type, context, toolbar, submenu) + # pylint: disable=old-api7-method-defined def xls_export(self, cr, uid, ids, context=None): return self.print_report(cr, uid, ids, context=context) + # pylint: disable=old-api7-method-defined def print_report(self, cr, uid, ids, context=None): if context is None: context = {} @@ -156,7 +158,7 @@ class account_print_journal_xls(orm.TransientModel): if aml_ids: journal_fy_ids.append((journal_id, fiscalyear_id)) if not journal_fy_ids: - raise orm.except_orm( + raise exceptions.except_orm( _('No Data Available'), _('No records found for your selection!')) datas.update({ @@ -180,7 +182,7 @@ class account_print_journal_xls(orm.TransientModel): if period_ids: journal_period_ids.append((journal_id, period_ids)) if not journal_period_ids: - raise orm.except_orm( + raise exceptions.except_orm( _('No Data Available'), _('No records found for your selection!')) datas.update({ diff --git a/account_journal_report_xls/wizard/print_journal_wizard.xml b/account_journal_report_xls/wizard/print_journal_wizard.xml index 6c3496e0..5ff82d11 100644 --- a/account_journal_report_xls/wizard/print_journal_wizard.xml +++ b/account_journal_report_xls/wizard/print_journal_wizard.xml @@ -1,10 +1,10 @@ - Print/Export Journals account.print.journal.xls + 99 @@ -19,7 +19,7 @@ - + @@ -53,7 +53,7 @@ action="action_print_journal_by_period_xls" id="menu_print_journal_by_period_xls" icon="STOCK_PRINT"/> - + Journal by Fiscal Year ir.actions.act_window @@ -75,6 +75,6 @@ 3 - + - \ No newline at end of file +