Browse Source

[FIX] lints

pull/352/head
Holger Brunn 7 years ago
parent
commit
13fa85ae5e
No known key found for this signature in database GPG Key ID: 1C9760FECA3AE18
  1. 69
      account_financial_report/report/parser.py
  2. 32
      account_financial_report/wizard/wizard.py
  3. 3
      account_financial_report_webkit/__openerp__.py
  4. 2
      account_financial_report_webkit/data/financial_webkit_header.xml
  5. 22
      account_financial_report_webkit/models/account.py
  6. 1
      account_financial_report_webkit/report/aged_open_invoices.py
  7. 1
      account_financial_report_webkit/report/aged_partner_balance.py
  8. 2
      account_financial_report_webkit/report/common_balance_reports.py
  9. 2
      account_financial_report_webkit/report/common_partner_balance_reports.py
  10. 2
      account_financial_report_webkit/report/common_partner_reports.py
  11. 12
      account_financial_report_webkit/report/common_reports.py
  12. 3
      account_financial_report_webkit/report/general_ledger.py
  13. 14
      account_financial_report_webkit/report/open_invoices.py
  14. 4
      account_financial_report_webkit/report/partner_balance.py
  15. 7
      account_financial_report_webkit/report/partners_ledger.py
  16. 3
      account_financial_report_webkit/report/print_journal.py
  17. 3
      account_financial_report_webkit/report/trial_balance.py
  18. 3
      account_financial_report_webkit/report/webkit_parser_header_fix.py
  19. 12
      account_financial_report_webkit/wizard/aged_open_invoices_wizard.py
  20. 1
      account_financial_report_webkit/wizard/aged_open_invoices_wizard.xml
  21. 35
      account_financial_report_webkit/wizard/aged_partner_balance_wizard.py
  22. 1
      account_financial_report_webkit/wizard/aged_partner_balance_wizard.xml
  23. 78
      account_financial_report_webkit/wizard/balance_common.py
  24. 54
      account_financial_report_webkit/wizard/general_ledger_wizard.py
  25. 1
      account_financial_report_webkit/wizard/general_ledger_wizard_view.xml
  26. 28
      account_financial_report_webkit/wizard/open_invoices_wizard.py
  27. 1
      account_financial_report_webkit/wizard/open_invoices_wizard_view.xml
  28. 1
      account_financial_report_webkit/wizard/partner_balance_wizard.py
  29. 1
      account_financial_report_webkit/wizard/partner_balance_wizard_view.xml
  30. 48
      account_financial_report_webkit/wizard/partners_ledger_wizard.py
  31. 1
      account_financial_report_webkit/wizard/partners_ledger_wizard_view.xml
  32. 24
      account_financial_report_webkit/wizard/print_journal.py
  33. 1
      account_financial_report_webkit/wizard/print_journal_view.xml
  34. 8
      account_financial_report_webkit/wizard/trial_balance_wizard.py
  35. 1
      account_financial_report_webkit/wizard/trial_balance_wizard_view.xml
  36. 1
      account_financial_report_webkit_xls/__openerp__.py
  37. 1
      account_financial_report_webkit_xls/report/aged_open_invoices_xls.py
  38. 1
      account_financial_report_webkit_xls/report/aged_partner_balance_xls.py
  39. 8
      account_financial_report_webkit_xls/report/general_ledger_xls.py
  40. 6
      account_financial_report_webkit_xls/report/open_invoices_xls.py
  41. 8
      account_financial_report_webkit_xls/report/partner_ledger_xls.py
  42. 8
      account_financial_report_webkit_xls/report/partners_balance_xls.py
  43. 1
      account_financial_report_webkit_xls/report/trial_balance_xls.py
  44. 2
      account_financial_report_webkit_xls/wizard/aged_open_invoices_wizard.py
  45. 2
      account_financial_report_webkit_xls/wizard/aged_partner_balance_wizard.py
  46. 2
      account_financial_report_webkit_xls/wizard/general_ledger_wizard.py
  47. 1
      account_financial_report_webkit_xls/wizard/general_ledger_wizard_view.xml
  48. 2
      account_financial_report_webkit_xls/wizard/open_invoices_wizard.py
  49. 1
      account_financial_report_webkit_xls/wizard/open_invoices_wizard_view.xml
  50. 2
      account_financial_report_webkit_xls/wizard/partners_balance_wizard.py
  51. 2
      account_financial_report_webkit_xls/wizard/partners_ledger_wizard.py
  52. 1
      account_financial_report_webkit_xls/wizard/partners_ledger_wizard_view.xml
  53. 2
      account_financial_report_webkit_xls/wizard/trial_balance_wizard.py
  54. 1
      account_financial_report_webkit_xls/wizard/trial_balance_wizard_view.xml
  55. 2
      account_journal_report_xls/__openerp__.py
  56. 11
      account_journal_report_xls/account_journal.py
  57. 16
      account_journal_report_xls/report/nov_account_journal.py
  58. 32
      account_journal_report_xls/report/nov_account_journal_xls.py
  59. 48
      account_journal_report_xls/wizard/print_journal_wizard.py
  60. 10
      account_journal_report_xls/wizard/print_journal_wizard.xml

69
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',

32
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 (<http://openerp.com.ve>).
@ -25,13 +25,11 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
##############################################################################
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()

3
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',

2
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 {

22
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."
)

1
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`"""

1
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`"""

2
account_financial_report_webkit/report/common_balance_reports.py

@ -1,4 +1,4 @@
# -*- encoding: utf-8 -*-
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier

2
account_financial_report_webkit/report/common_partner_balance_reports.py

@ -1,4 +1,4 @@
# -*- encoding: utf-8 -*-
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier

2
account_financial_report_webkit/report/common_partner_reports.py

@ -1,4 +1,4 @@
# -*- encoding: utf-8 -*-
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Nicolas Bessi, Guewen Baconnier

12
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,

3
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)

14
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'):

4
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)

7
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

3
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:

3
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)

3
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"""

12
account_financial_report_webkit/wizard/aged_open_invoices_wizard.py

@ -19,24 +19,23 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
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)

1
account_financial_report_webkit/wizard/aged_open_invoices_wizard.xml

@ -5,6 +5,7 @@
<record id="aged_open_invoice_webkit" model="ir.ui.view">
<field name="name">Aged Open Invoice Report</field>
<field name="model">aged.open.invoices.webkit</field>
<field name="priority">99</field>
<field name="inherit_id" ref="account.account_common_report_view"/>
<field name="arch" type="xml">
<data>

35
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)

1
account_financial_report_webkit/wizard/aged_partner_balance_wizard.xml

@ -5,6 +5,7 @@
<record id="account_aged_trial_balance_webkit" model="ir.ui.view">
<field name="name">Aged Partner Balance Report</field>
<field name="model">account.aged.trial.balance.webkit</field>
<field name="priority">99</field>
<field name="inherit_id" ref="account.account_common_report_view"/>
<field name="arch" type="xml">
<data>

78
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)

54
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)

1
account_financial_report_webkit/wizard/general_ledger_wizard_view.xml

@ -5,6 +5,7 @@
<record id="account_report_general_ledger_view_webkit" model="ir.ui.view">
<field name="name">General Ledger</field>
<field name="model">general.ledger.webkit</field>
<field name="priority">99</field>
<field name="inherit_id" ref="account.account_common_report_view"/>
<field name="arch" type="xml">
<data>

28
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 <http://www.gnu.org/licenses/>.
#
##############################################################################
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)

1
account_financial_report_webkit/wizard/open_invoices_wizard_view.xml

@ -5,6 +5,7 @@
<record id="account_open_invoices_view_webkit" model="ir.ui.view">
<field name="name">Open Invoices Report</field>
<field name="model">open.invoices.webkit</field>
<field name="priority">99</field>
<field name="inherit_id" ref="account.account_common_report_view"/>
<field name="arch" type="xml">
<data>

1
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"

1
account_financial_report_webkit/wizard/partner_balance_wizard_view.xml

@ -9,6 +9,7 @@
<record id="account_partner_balance_view_webkit" model="ir.ui.view">
<field name="name">Partner Balance</field>
<field name="model">partner.balance.webkit</field>
<field name="priority">99</field>
<field name="inherit_id" ref="account.account_common_report_view"/>
<field name="arch" type="xml">
<data>

48
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)

1
account_financial_report_webkit/wizard/partners_ledger_wizard_view.xml

@ -5,6 +5,7 @@
<record id="account_partner_ledger_view_webkit" model="ir.ui.view">
<field name="name">Partner Ledger</field>
<field name="model">partners.ledger.webkit</field>
<field name="priority">99</field>
<field name="inherit_id" ref="account.account_common_report_view"/>
<field name="arch" type="xml">
<data>

24
account_financial_report_webkit/wizard/print_journal.py

@ -21,30 +21,25 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
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

1
account_financial_report_webkit/wizard/print_journal_view.xml

@ -28,6 +28,7 @@
<field name="name">Journals</field>
<field name="model">print.journal.webkit</field>
<field name="type">form</field>
<field name="priority">99</field>
<field name="inherit_id" ref="account.account_common_report_view"/>
<field name="arch" type="xml">
<data>

8
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 <http://www.gnu.org/licenses/>.
#
##############################################################################
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

1
account_financial_report_webkit/wizard/trial_balance_wizard_view.xml

@ -9,6 +9,7 @@
<record id="account_trial_balance_view_webkit" model="ir.ui.view">
<field name="name">Trial Balance</field>
<field name="model">trial.balance.webkit</field>
<field name="priority">99</field>
<field name="inherit_id" ref="account.account_common_report_view"/>
<field name="arch" type="xml">
<data>

1
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,
}

1
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

1
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

8
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)

6
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)

8
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)

8
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)

1
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

2
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'):

2
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'):

2
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'):

1
account_financial_report_webkit_xls/wizard/general_ledger_wizard_view.xml

@ -5,6 +5,7 @@
<record id="account_report_general_ledger_view_webkit" model="ir.ui.view">
<field name="name">general.ledger.webkit.xls</field>
<field name="model">general.ledger.webkit</field>
<field name="priority">99</field>
<field name="type">form</field>
<field name="inherit_id" ref="account_financial_report_webkit.account_report_general_ledger_view_webkit"/>
<field name="arch" type="xml">

2
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'):

1
account_financial_report_webkit_xls/wizard/open_invoices_wizard_view.xml

@ -5,6 +5,7 @@
<record id="account_open_invoices_view_webkit" model="ir.ui.view">
<field name="name">open.invoices.webkit.xls</field>
<field name="model">open.invoices.webkit</field>
<field name="priority">99</field>
<field name="type">form</field>
<field name="inherit_id" ref="account_financial_report_webkit.account_open_invoices_view_webkit"/>
<field name="arch" type="xml">

2
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'):

2
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'):

1
account_financial_report_webkit_xls/wizard/partners_ledger_wizard_view.xml

@ -5,6 +5,7 @@
<record id="account_partner_ledger_view_webkit" model="ir.ui.view">
<field name="name">partners.ledger.webkit.xls</field>
<field name="model">partners.ledger.webkit</field>
<field name="priority">99</field>
<field name="type">form</field>
<field name="inherit_id" ref="account_financial_report_webkit.account_partner_ledger_view_webkit"/>
<field name="arch" type="xml">

2
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'):

1
account_financial_report_webkit_xls/wizard/trial_balance_wizard_view.xml

@ -5,6 +5,7 @@
<record id="account_trial_balance_view_webkit" model="ir.ui.view">
<field name="name">trial.balance.webkit.xls</field>
<field name="model">trial.balance.webkit</field>
<field name="priority">99</field>
<field name="type">form</field>
<field name="inherit_id" ref="account_financial_report_webkit.account_trial_balance_view_webkit"/>
<field name="arch" type="xml">

2
account_journal_report_xls/__openerp__.py

@ -1,4 +1,4 @@
# -*- encoding: utf-8 -*-
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution

11
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 <http://www.gnu.org/licenses/>.
#
##############################################################################
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.

16
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)

32
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,
)

48
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 <http://www.gnu.org/licenses/>.
#
##############################################################################
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({

10
account_journal_report_xls/wizard/print_journal_wizard.xml

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_print_journal_xls" model="ir.ui.view">
<field name="name">Print/Export Journals</field>
<field name="model">account.print.journal.xls</field>
<field name="priority">99</field>
<field name="inherit_id" ref="account.account_common_report_view"/>
<field name="arch" type="xml">
<data>
@ -19,7 +19,7 @@
</xpath>
<xpath expr="//field[@name='target_move']" position="after">
<field name="sort_selection"/>
<field name="amount_currency"/>
<field name="amount_currency"/>
<field name="group_entries"/>
<newline/>
<separator string="Periods" colspan="4"/>
@ -53,7 +53,7 @@
action="action_print_journal_by_period_xls"
id="menu_print_journal_by_period_xls"
icon="STOCK_PRINT"/>
<record id="action_print_journal_by_fiscalyear_xls" model="ir.actions.act_window">
<field name="name">Journal by Fiscal Year</field>
<field name="type">ir.actions.act_window</field>
@ -75,6 +75,6 @@
<record id="account.menu_account_print_sale_purchase_journal" model="ir.ui.menu">
<field name="sequence">3</field>
</record>
</data>
</openerp>
</openerp>
Loading…
Cancel
Save