Browse Source

Merge pull request #253 from Noviat/8.0-fix-webkit-reports

[MERGE] pep8 and context propagation #253
pull/260/head
Stéphane Bidoul (ACSONE) 8 years ago
committed by GitHub
parent
commit
8af139631a
  1. 3
      account_financial_report_webkit/report/aged_open_invoices.py
  2. 3
      account_financial_report_webkit/report/aged_partner_balance.py
  3. 1
      account_financial_report_webkit/report/open_invoices.py
  4. 1
      account_financial_report_webkit/report/partner_balance.py
  5. 1
      account_financial_report_webkit/report/print_journal.py
  6. 1
      account_financial_report_webkit/report/trial_balance.py
  7. 2
      account_financial_report_webkit/wizard/balance_common.py
  8. 2
      account_financial_report_webkit/wizard/general_ledger_wizard.py
  9. 2
      account_financial_report_webkit/wizard/open_invoices_wizard.py
  10. 2
      account_financial_report_webkit/wizard/partners_ledger_wizard.py
  11. 2
      account_financial_report_webkit/wizard/print_journal.py
  12. 23
      account_financial_report_webkit_xls/report/__init__.py
  13. 26
      account_financial_report_webkit_xls/report/general_ledger_xls.py
  14. 26
      account_financial_report_webkit_xls/report/open_invoices_xls.py
  15. 26
      account_financial_report_webkit_xls/report/partner_ledger_xls.py
  16. 26
      account_financial_report_webkit_xls/report/partners_balance_xls.py
  17. 26
      account_financial_report_webkit_xls/report/trial_balance_xls.py
  18. 31
      account_journal_report_xls/report/nov_account_journal.py
  19. 25
      account_journal_report_xls/report/nov_account_journal_xls.py
  20. 26
      account_move_line_report_xls/report/move_line_list_xls.py

3
account_financial_report_webkit/report/aged_open_invoices.py

@ -45,6 +45,7 @@ def make_ranges(top, offset):
ranges.append((top, 100000000000))
return ranges
# list of overdue ranges
RANGES = make_ranges(120, 30)
@ -56,6 +57,7 @@ def make_ranges_titles():
titles.append(_('Overdue > %s d.') % RANGES[-1][0])
return titles
# list of overdue ranges title
RANGES_TITLES = make_ranges_titles()
# list of payable journal types
@ -408,6 +410,7 @@ class AccountAgedOpenInvoicesWebkit(PartnersOpenInvoicesWebkit):
res = self.cr.fetchall()
return dict((x[0], x[1]) for x in res)
HeaderFooterTextWebKitParser(
'report.account.account_aged_open_invoices_webkit',
'account.account',

3
account_financial_report_webkit/report/aged_partner_balance.py

@ -43,6 +43,7 @@ def make_ranges(top, offset):
ranges.append((top, 100000000000))
return ranges
# list of overdue ranges
RANGES = make_ranges(120, 30)
@ -54,6 +55,7 @@ def make_ranges_titles():
titles.append(_('Overdue > %s d.') % RANGES[-1][0])
return titles
# list of overdue ranges title
RANGES_TITLES = make_ranges_titles()
# list of payable journal types
@ -420,6 +422,7 @@ class AccountAgedTrialBalanceWebkit(PartnersOpenInvoicesWebkit):
res = self.cr.fetchall()
return dict((x[0], x[1]) for x in res)
HeaderFooterTextWebKitParser(
'report.account.account_aged_trial_balance_webkit',
'account.account',

1
account_financial_report_webkit/report/open_invoices.py

@ -40,6 +40,7 @@ def get_mako_template(obj, *args):
template_path = get_module_resource(*args)
return Template(filename=template_path, input_encoding='utf-8')
report_helper.WebKitHelper.get_mako_template = get_mako_template

1
account_financial_report_webkit/report/partner_balance.py

@ -93,6 +93,7 @@ class PartnerBalanceWebkit(report_sxw.rml_parse,
return super(PartnerBalanceWebkit, self).set_context(
objects, data, new_ids, report_type=report_type)
HeaderFooterTextWebKitParser(
'report.account.account_report_partner_balance_webkit',
'account.account',

1
account_financial_report_webkit/report/print_journal.py

@ -158,6 +158,7 @@ class PrintJournalWebkit(report_sxw.rml_parse, CommonReportHeaderWebkit):
return super(PrintJournalWebkit, self).set_context(
objects, data, new_ids, report_type=report_type)
HeaderFooterTextWebKitParser(
'report.account.account_report_print_journal_webkit',
'account.journal.period',

1
account_financial_report_webkit/report/trial_balance.py

@ -85,6 +85,7 @@ class TrialBalanceWebkit(report_sxw.rml_parse,
return super(TrialBalanceWebkit, self).set_context(
objects, data, new_ids, report_type=report_type)
HeaderFooterTextWebKitParser(
'report.account.account_report_trial_balance_webkit',
'account.account',

2
account_financial_report_webkit/wizard/balance_common.py

@ -392,7 +392,7 @@ class AccountBalanceCommonWizard(orm.TransientModel):
def pre_print_report(self, cr, uid, ids, data, context=None):
data = super(AccountBalanceCommonWizard, self).pre_print_report(
cr, uid, ids, data, context)
cr, uid, ids, data, context=context)
if context is None:
context = {}

2
account_financial_report_webkit/wizard/general_ledger_wizard.py

@ -78,7 +78,7 @@ class AccountReportGeneralLedgerWizard(orm.TransientModel):
def pre_print_report(self, cr, uid, ids, data, context=None):
data = super(AccountReportGeneralLedgerWizard, self).pre_print_report(
cr, uid, ids, data, context)
cr, uid, ids, data, context=context)
# will be used to attach the report on the main account
data['ids'] = [data['form']['chart_account_id']]
vals = self.read(cr, uid, ids,

2
account_financial_report_webkit/wizard/open_invoices_wizard.py

@ -133,7 +133,7 @@ are still unpaid today (today is my clearance date)?'
def pre_print_report(self, cr, uid, ids, data, context=None):
data = super(AccountReportOpenInvoicesWizard, self).pre_print_report(
cr, uid, ids, data, context)
cr, uid, ids, data, context=context)
vals = self.read(cr, uid, ids,
['until_date', 'group_by_currency'],
context=context)[0]

2
account_financial_report_webkit/wizard/partners_ledger_wizard.py

@ -121,7 +121,7 @@ class AccountReportPartnersLedgerWizard(orm.TransientModel):
def pre_print_report(self, cr, uid, ids, data, context=None):
data = super(AccountReportPartnersLedgerWizard, self).pre_print_report(
cr, uid, ids, data, context)
cr, uid, ids, data, context=context)
if context is None:
context = {}
# will be used to attach the report on the main account

2
account_financial_report_webkit/wizard/print_journal.py

@ -59,7 +59,7 @@ class AccountReportPrintJournalWizard(orm.TransientModel):
def pre_print_report(self, cr, uid, ids, data, context=None):
data = super(AccountReportPrintJournalWizard, self).\
pre_print_report(cr, uid, ids, data, context)
pre_print_report(cr, uid, ids, data, context=context)
# will be used to attach the report on the main account
data['ids'] = [data['form']['chart_account_id']]
vals = self.read(cr, uid, ids,

23
account_financial_report_webkit_xls/report/__init__.py

@ -1,25 +1,4 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
#
# Copyright (c) 2013 Noviat nv/sa (www.noviat.com). All rights reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# -*- coding: utf-8 -*-
from . import general_ledger_xls
from . import trial_balance_xls
from . import partners_balance_xls

26
account_financial_report_webkit_xls/report/general_ledger_xls.py

@ -1,25 +1,6 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
#
# Copyright (c) 2013 Noviat nv/sa (www.noviat.com). All rights reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# -*- coding: utf-8 -*-
# Copyright 2009-2016 Noviat
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import xlwt
from datetime import datetime
from openerp.addons.report_xls.report_xls import report_xls
@ -345,6 +326,7 @@ class general_ledger_xls(report_xls):
ws, row_pos, row_data, c_hdr_cell_style)
row_pos += 1
general_ledger_xls('report.account.account_report_general_ledger_xls',
'account.account',
parser=GeneralLedgerWebkit)

26
account_financial_report_webkit_xls/report/open_invoices_xls.py

@ -1,25 +1,6 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
#
# Copyright (c) 2013 Noviat nv/sa (www.noviat.com). All rights reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# -*- coding: utf-8 -*-
# Copyright 2009-2016 Noviat
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import xlwt
from datetime import datetime
from openerp.addons.report_xls.report_xls import report_xls
@ -824,5 +805,6 @@ class open_invoices_xls(report_xls):
row_pos, acc, _xs, xlwt, _p, data)
row_pos += 1
open_invoices_xls('report.account.account_report_open_invoices_xls',
'account.account', parser=PartnersOpenInvoicesWebkit)

26
account_financial_report_webkit_xls/report/partner_ledger_xls.py

@ -1,25 +1,6 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
#
# Copyright (c) 2013 Noviat nv/sa (www.noviat.com). All rights reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# -*- coding: utf-8 -*-
# Copyright 2009-2016 Noviat
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import xlwt
from datetime import datetime
from openerp.addons.report_xls.report_xls import report_xls
@ -456,6 +437,7 @@ class partner_ledger_xls(report_xls):
ws, row_pos, row_data, account_cell_style)
row_pos += 2
partner_ledger_xls('report.account.account_report_partner_ledger_xls',
'account.account',
parser=PartnersLedgerWebkit)

26
account_financial_report_webkit_xls/report/partners_balance_xls.py

@ -1,25 +1,6 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
#
# Copyright (c) 2013 Noviat nv/sa (www.noviat.com). All rights reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# -*- coding: utf-8 -*-
# Copyright 2009-2016 Noviat
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import xlwt
from openerp.addons.report_xls.report_xls import report_xls
from openerp.addons.report_xls.utils import rowcol_to_cell
@ -427,6 +408,7 @@ class partners_balance_xls(report_xls):
row_pos = self.print_account_totals(
_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)

26
account_financial_report_webkit_xls/report/trial_balance_xls.py

@ -1,25 +1,6 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
#
# Copyright (c) 2013 Noviat nv/sa (www.noviat.com). All rights reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# -*- coding: utf-8 -*-
# Copyright 2009-2016 Noviat
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import xlwt
from openerp.addons.report_xls.report_xls import report_xls
from openerp.addons.report_xls.utils import rowcol_to_cell
@ -319,6 +300,7 @@ class trial_balance_xls(report_xls):
row_pos = self.xls_write_row(
ws, row_pos, row_data, row_style=cell_style)
trial_balance_xls('report.account.account_report_trial_balance_xls',
'account.account',
parser=TrialBalanceWebkit)

31
account_journal_report_xls/report/nov_account_journal.py

@ -1,24 +1,6 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
#
# Copyright (c) 2014 Noviat nv/sa (www.noviat.com). All rights reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# -*- coding: utf-8 -*-
# Copyright 2009-2016 Noviat
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import time
from openerp.report import report_sxw
@ -215,7 +197,11 @@ 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)
[x.update({'docname': eval(code_string) or '-'}) for x in lines]
# disable=W0123, safe_eval doesn't apply here since
# code_string comes from python module
[x.update(
{'docname': eval(code_string) or '-'}) # pylint: disable=W0123
for x in lines]
# group lines
if self.group_entries:
@ -352,6 +338,7 @@ class nov_journal_print(report_sxw.rml_parse):
value, digits,
date, date_time, grouping, monetary, dp, currency_obj)
report_sxw.report_sxw(
'report.nov.account.journal.print', 'account.journal',
'addons/account_journal_report_xls/report/nov_account_journal.rml',

25
account_journal_report_xls/report/nov_account_journal_xls.py

@ -1,24 +1,6 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
#
# Copyright (c) 2013 Noviat nv/sa (www.noviat.com). All rights reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# -*- coding: utf-8 -*-
# Copyright 2009-2016 Noviat
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import xlwt
from datetime import datetime
@ -404,5 +386,6 @@ class account_journal_xls(report_xls):
row_pos = self._journal_lines(o, ws, _p, row_pos, _xs)
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)

26
account_move_line_report_xls/report/move_line_list_xls.py

@ -1,25 +1,6 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
#
# Copyright (c) 2014 Noviat nv/sa (www.noviat.com). All rights reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# -*- coding: utf-8 -*-
# Copyright 2009-2016 Noviat
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import xlwt
from datetime import datetime
from openerp.osv import orm
@ -368,6 +349,7 @@ class move_line_xls(report_xls):
row_pos = self.xls_write_row(
ws, row_pos, row_data, row_style=self.rt_cell_style_right)
move_line_xls('report.move.line.list.xls',
'account.move.line',
parser=move_line_xls_parser)
Loading…
Cancel
Save