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. 18
      account_financial_report_webkit/models/account.py
  5. 1
      account_financial_report_webkit/report/aged_open_invoices.py
  6. 1
      account_financial_report_webkit/report/aged_partner_balance.py
  7. 2
      account_financial_report_webkit/report/common_balance_reports.py
  8. 2
      account_financial_report_webkit/report/common_partner_balance_reports.py
  9. 2
      account_financial_report_webkit/report/common_partner_reports.py
  10. 12
      account_financial_report_webkit/report/common_reports.py
  11. 3
      account_financial_report_webkit/report/general_ledger.py
  12. 14
      account_financial_report_webkit/report/open_invoices.py
  13. 4
      account_financial_report_webkit/report/partner_balance.py
  14. 7
      account_financial_report_webkit/report/partners_ledger.py
  15. 3
      account_financial_report_webkit/report/print_journal.py
  16. 3
      account_financial_report_webkit/report/trial_balance.py
  17. 3
      account_financial_report_webkit/report/webkit_parser_header_fix.py
  18. 12
      account_financial_report_webkit/wizard/aged_open_invoices_wizard.py
  19. 1
      account_financial_report_webkit/wizard/aged_open_invoices_wizard.xml
  20. 33
      account_financial_report_webkit/wizard/aged_partner_balance_wizard.py
  21. 1
      account_financial_report_webkit/wizard/aged_partner_balance_wizard.xml
  22. 54
      account_financial_report_webkit/wizard/balance_common.py
  23. 52
      account_financial_report_webkit/wizard/general_ledger_wizard.py
  24. 1
      account_financial_report_webkit/wizard/general_ledger_wizard_view.xml
  25. 26
      account_financial_report_webkit/wizard/open_invoices_wizard.py
  26. 1
      account_financial_report_webkit/wizard/open_invoices_wizard_view.xml
  27. 1
      account_financial_report_webkit/wizard/partner_balance_wizard.py
  28. 1
      account_financial_report_webkit/wizard/partner_balance_wizard_view.xml
  29. 40
      account_financial_report_webkit/wizard/partners_ledger_wizard.py
  30. 1
      account_financial_report_webkit/wizard/partners_ledger_wizard_view.xml
  31. 24
      account_financial_report_webkit/wizard/print_journal.py
  32. 1
      account_financial_report_webkit/wizard/print_journal_view.xml
  33. 8
      account_financial_report_webkit/wizard/trial_balance_wizard.py
  34. 1
      account_financial_report_webkit/wizard/trial_balance_wizard_view.xml
  35. 1
      account_financial_report_webkit_xls/__openerp__.py
  36. 1
      account_financial_report_webkit_xls/report/aged_open_invoices_xls.py
  37. 1
      account_financial_report_webkit_xls/report/aged_partner_balance_xls.py
  38. 4
      account_financial_report_webkit_xls/report/general_ledger_xls.py
  39. 4
      account_financial_report_webkit_xls/report/open_invoices_xls.py
  40. 4
      account_financial_report_webkit_xls/report/partner_ledger_xls.py
  41. 4
      account_financial_report_webkit_xls/report/partners_balance_xls.py
  42. 1
      account_financial_report_webkit_xls/report/trial_balance_xls.py
  43. 2
      account_financial_report_webkit_xls/wizard/aged_open_invoices_wizard.py
  44. 2
      account_financial_report_webkit_xls/wizard/aged_partner_balance_wizard.py
  45. 2
      account_financial_report_webkit_xls/wizard/general_ledger_wizard.py
  46. 1
      account_financial_report_webkit_xls/wizard/general_ledger_wizard_view.xml
  47. 2
      account_financial_report_webkit_xls/wizard/open_invoices_wizard.py
  48. 1
      account_financial_report_webkit_xls/wizard/open_invoices_wizard_view.xml
  49. 2
      account_financial_report_webkit_xls/wizard/partners_balance_wizard.py
  50. 2
      account_financial_report_webkit_xls/wizard/partners_ledger_wizard.py
  51. 1
      account_financial_report_webkit_xls/wizard/partners_ledger_wizard_view.xml
  52. 2
      account_financial_report_webkit_xls/wizard/trial_balance_wizard.py
  53. 1
      account_financial_report_webkit_xls/wizard/trial_balance_wizard_view.xml
  54. 2
      account_journal_report_xls/__openerp__.py
  55. 11
      account_journal_report_xls/account_journal.py
  56. 16
      account_journal_report_xls/report/nov_account_journal.py
  57. 28
      account_journal_report_xls/report/nov_account_journal_xls.py
  58. 38
      account_journal_report_xls/wizard/print_journal_wizard.py
  59. 2
      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): def exchange_name(self, form):
self.from_currency_id = self.\ 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']: if not form['currency_id']:
self.to_currency_id = self.from_currency_id self.to_currency_id = self.from_currency_id
else: else:
@ -543,17 +544,18 @@ class account_balance(report_sxw.rml_parse):
self.context['state'] = form['target_move'] or 'posted' self.context['state'] = form['target_move'] or 'posted'
self.from_currency_id = self.\ 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']: if not form['currency_id']:
self.to_currency_id = self.from_currency_id self.to_currency_id = self.from_currency_id
else: 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']: if 'account_list' in form and form['account_list']:
account_ids = form['account_list'] account_ids = form['account_list']
@ -561,16 +563,18 @@ class account_balance(report_sxw.rml_parse):
del form['account_list'] del form['account_list']
credit_account_ids = self.\ 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.\ 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 form.get('fiscalyear'):
if type(form.get('fiscalyear')) in (list, tuple): 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( account_ids = _get_children_and_consol(
self.cr, self.uid, account_ids, 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( credit_account_ids = _get_children_and_consol(
self.cr, self.uid, credit_account_ids, 100, self.context, self.cr, self.uid, credit_account_ids, 100, self.context,
@ -622,16 +625,16 @@ class account_balance(report_sxw.rml_parse):
('special', '=', False)], ('special', '=', False)],
order='date_start asc') order='date_start asc')
a = 0 a = 0
l = []
l1 = []
p = [] p = []
for x in period_ids: for x in period_ids:
a += 1 a += 1
if a < 3: if a < 3:
l.append(x)
l1.append(x)
else: else:
l.append(x)
p.append(l)
l = []
l1.append(x)
p.append(l1)
l1 = []
a = 0 a = 0
tot_bal1 = 0.0 tot_bal1 = 0.0
tot_bal2 = 0.0 tot_bal2 = 0.0
@ -845,15 +848,14 @@ class account_balance(report_sxw.rml_parse):
'id': id, 'id': id,
'type': aa_id[3].type, 'type': aa_id[3].type,
'code': aa_id[3].code, '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, 'parent_id': aa_id[3].parent_id and aa_id[3].parent_id.id,
'level': aa_id[3].level, 'level': aa_id[3].level,
'label': aa_id[1], 'label': aa_id[1],
'total': aa_id[2], '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': if form['columns'] == 'qtr':
@ -1174,6 +1176,7 @@ class account_balance(report_sxw.rml_parse):
result_acc.append(res2) result_acc.append(res2)
return result_acc return result_acc
report_sxw.report_sxw( report_sxw.report_sxw(
'report.afr.1cols', 'report.afr.1cols',
'wizard.report', '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 # Module Writen to OpenERP, Open Source Management Solution
# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
@ -25,13 +25,11 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # 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 import time
from openerp.tools.translate import _
class wizard_report(osv.osv_memory):
class WizardReport(models.TransientModel):
_name = "wizard.report" _name = "wizard.report"
_columns = { _columns = {
@ -208,20 +206,20 @@ class wizard_report(osv.osv_memory):
return res return res
afr_brw = self.pool.get('afr').browse(cr, uid, afr_id, context=context) afr_brw = self.pool.get('afr').browse(cr, uid, afr_id, context=context)
res['value'].update({ 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({'inf_type': afr_brw.inf_type or 'BS'})
res['value'].update({'columns': afr_brw.columns or 'five'}) res['value'].update({'columns': afr_brw.columns or 'five'})
res['value'].update({ res['value'].update({
'display_account': afr_brw.display_account
or 'bal_mov'})
'display_account': afr_brw.display_account or 'bal_mov',
})
res['value'].update({ 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({ 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': [ res['value'].update({'account_list': [
acc.id for acc in afr_brw.account_ids]}) acc.id for acc in afr_brw.account_ids]})
res['value'].update({'periods': [p.id for p in afr_brw.period_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() res = cr.dictfetchall()
if res: 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'), raise osv.except_osv(_('UserError'),
'Las fechas deben estar entre %s y %s' 'Las fechas deben estar entre %s y %s'
% (res[0]['date_start'], % (res[0]['date_start'],
@ -369,5 +367,3 @@ class wizard_report(osv.osv_memory):
return {'type': 'ir.actions.report.xml', return {'type': 'ir.actions.report.xml',
'report_name': name, 'report_name': name,
'datas': data} '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 # Authors: Nicolas Bessi, Guewen Baconnier
@ -57,7 +57,6 @@
'test/open_invoices.yml', 'test/open_invoices.yml',
'test/aged_trial_balance.yml'], 'test/aged_trial_balance.yml'],
# 'tests/account_move_line.yml' # 'tests/account_move_line.yml'
'active': False,
'installable': True, 'installable': True,
'application': True, 'application': True,
'pre_init_hook': 'pre_init_hook', 'pre_init_hook': 'pre_init_hook',

18
account_financial_report_webkit/models/account.py

@ -27,21 +27,15 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # 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' _inherit = 'account.account'
_columns = {
'centralized': fields.boolean(
'Centralized',
centralized = fields.Boolean(
'Centralized', default=False,
help="If flagged, no details will be displayed in " help="If flagged, no details will be displayed in "
"the General Ledger report (the webkit one only), " "the General Ledger report (the webkit one only), "
"only centralized amounts per period."),
}
_defaults = {
'centralized': False,
}
"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""" """Compute Aged Open Invoices based on result of Open Invoices"""
# pylint: disable=old-api7-method-defined
def __init__(self, cursor, uid, name, context=None): def __init__(self, cursor, uid, name, context=None):
"""Constructor, """Constructor,
refer to :class:`openerp.report.report_sxw.rml_parse`""" 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""" """Compute Aged Partner Balance based on result of Open Invoices"""
# pylint: disable=old-api7-method-defined
def __init__(self, cursor, uid, name, context=None): def __init__(self, cursor, uid, name, context=None):
"""Constructor, """Constructor,
refer to :class:`openerp.report.report_sxw.rml_parse`""" 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 # 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 # 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 # 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 # Author: Nicolas Bessi, Guewen Baconnier
@ -24,7 +24,7 @@
import logging import logging
from openerp.osv import osv
from openerp.exceptions import except_orm
from openerp.tools.translate import _ from openerp.tools.translate import _
from openerp.addons.account.report.common_report_header \ from openerp.addons.account.report.common_report_header \
import common_report_header import common_report_header
@ -361,7 +361,7 @@ class CommonReportHeaderWebkit(common_report_header):
limit=1, limit=1,
order='date_start %s' % (order,)) order='date_start %s' % (order,))
if not p_id: 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]) 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( opening_period_selected = self.get_included_opening_period(
start_period) start_period)
if not opening_period_selected: if not opening_period_selected:
raise osv.except_osv(
raise except_orm(
_('Error'), _('Error'),
_('No opening period found to compute the opening balances.\n' _('No opening period found to compute the opening balances.\n'
'You have to configure a period on the first of January' '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'): target_move, mode='include_opening'):
"""Get account move lines base on form data""" """Get account move lines base on form data"""
if mode not in ('include_opening', 'exclude_opening'): if mode not in ('include_opening', 'exclude_opening'):
raise osv.except_osv(
raise except_orm(
_('Invalid query mode'), _('Invalid query mode'),
_('Must be in include_opening, exclude_opening')) _('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, return self._get_move_ids_from_dates(account_id, start, stop,
target_move) target_move)
else: else:
raise osv.except_osv(
raise except_orm(
_('No valid filter'), _('Please set a valid time filter')) _('No valid filter'), _('Please set a valid time filter'))
def _get_move_line_datas(self, move_line_ids, 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 # Author: Nicolas Bessi, Guewen Baconnier
@ -32,6 +32,7 @@ from .webkit_parser_header_fix import HeaderFooterTextWebKitParser
class GeneralLedgerWebkit(report_sxw.rml_parse, CommonReportHeaderWebkit): class GeneralLedgerWebkit(report_sxw.rml_parse, CommonReportHeaderWebkit):
# pylint: disable=old-api7-method-defined
def __init__(self, cursor, uid, name, context): def __init__(self, cursor, uid, name, context):
super(GeneralLedgerWebkit, self).__init__( super(GeneralLedgerWebkit, self).__init__(
cursor, uid, name, context=context) 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 # Author: Nicolas Bessi, Guewen Baconnier
@ -27,7 +27,7 @@ from mako.template import Template
from openerp.modules.registry import RegistryManager 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.report import report_sxw
from openerp.tools.translate import _ from openerp.tools.translate import _
from openerp.addons.report_webkit import report_helper 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, class PartnersOpenInvoicesWebkit(report_sxw.rml_parse,
CommonPartnersReportHeaderWebkit): CommonPartnersReportHeaderWebkit):
# pylint: disable=old-api7-method-defined
def __init__(self, cursor, uid, name, context): def __init__(self, cursor, uid, name, context):
super(PartnersOpenInvoicesWebkit, self).__init__( super(PartnersOpenInvoicesWebkit, self).__init__(
cursor, uid, name, context=context) cursor, uid, name, context=context)
@ -134,7 +134,7 @@ class PartnersOpenInvoicesWebkit(report_sxw.rml_parse,
new_ids, exclude_type=['view'], only_type=filter_type) new_ids, exclude_type=['view'], only_type=filter_type)
if not account_ids: 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 # computation of ledeger lines
if main_filter == 'filter_date': if main_filter == 'filter_date':
@ -210,9 +210,9 @@ class PartnersOpenInvoicesWebkit(report_sxw.rml_parse,
date_until_match = (stop == date_until) date_until_match = (stop == date_until)
else: 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 = {} initial_move_lines_per_account = {}
if main_filter in ('filter_period', 'filter_no'): 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 # Author: Guewen Baconnier
@ -32,7 +32,7 @@ from .webkit_parser_header_fix import HeaderFooterTextWebKitParser
class PartnerBalanceWebkit(report_sxw.rml_parse, class PartnerBalanceWebkit(report_sxw.rml_parse,
CommonPartnerBalanceReportHeaderWebkit): CommonPartnerBalanceReportHeaderWebkit):
# pylint: disable=old-api7-method-defined
def __init__(self, cursor, uid, name, context): def __init__(self, cursor, uid, name, context):
super(PartnerBalanceWebkit, self).__init__( super(PartnerBalanceWebkit, self).__init__(
cursor, uid, name, context=context) 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 # Author: Nicolas Bessi, Guewen Baconnier
@ -23,7 +23,7 @@ from collections import defaultdict
from datetime import datetime from datetime import datetime
from openerp.modules.registry import RegistryManager 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.report import report_sxw
from openerp.tools.translate import _ from openerp.tools.translate import _
from .common_partner_reports import CommonPartnersReportHeaderWebkit from .common_partner_reports import CommonPartnersReportHeaderWebkit
@ -33,6 +33,7 @@ from .webkit_parser_header_fix import HeaderFooterTextWebKitParser
class PartnersLedgerWebkit(report_sxw.rml_parse, class PartnersLedgerWebkit(report_sxw.rml_parse,
CommonPartnersReportHeaderWebkit): CommonPartnersReportHeaderWebkit):
# pylint: disable=old-api7-method-defined
def __init__(self, cursor, uid, name, context): def __init__(self, cursor, uid, name, context):
super(PartnersLedgerWebkit, self).__init__( super(PartnersLedgerWebkit, self).__init__(
cursor, uid, name, context=context) cursor, uid, name, context=context)
@ -116,7 +117,7 @@ class PartnersLedgerWebkit(report_sxw.rml_parse,
only_type=filter_type) only_type=filter_type)
if not accounts: 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': if main_filter == 'filter_date':
start = start_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): class PrintJournalWebkit(report_sxw.rml_parse, CommonReportHeaderWebkit):
# pylint: disable=old-api7-method-defined
def __init__(self, cursor, uid, name, context): def __init__(self, cursor, uid, name, context):
super(PrintJournalWebkit, self).__init__(cursor, uid, name, super(PrintJournalWebkit, self).__init__(cursor, uid, name,
context=context) context=context)
@ -165,5 +166,3 @@ HeaderFooterTextWebKitParser(
'addons/account_financial_report_webkit/report/templates/\ 'addons/account_financial_report_webkit/report/templates/\
account_report_print_journal.mako', account_report_print_journal.mako',
parser=PrintJournalWebkit) 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 # Author: Guewen Baconnier
@ -36,6 +36,7 @@ def sign(number):
class TrialBalanceWebkit(report_sxw.rml_parse, class TrialBalanceWebkit(report_sxw.rml_parse,
CommonBalanceReportHeaderWebkit): CommonBalanceReportHeaderWebkit):
# pylint: disable=old-api7-method-defined
def __init__(self, cursor, uid, name, context): def __init__(self, cursor, uid, name, context):
super(TrialBalanceWebkit, self).__init__(cursor, uid, name, super(TrialBalanceWebkit, self).__init__(cursor, uid, name,
context=context) 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 mako import exceptions
from openerp.osv.orm import except_orm
from openerp.exceptions import except_orm
from openerp.tools.translate import _ from openerp.tools.translate import _
from openerp.modules.registry import RegistryManager from openerp.modules.registry import RegistryManager
from openerp import tools from openerp import tools
@ -182,6 +182,7 @@ class HeaderFooterTextWebKitParser(webkit_report.WebKitParser):
return pdf return pdf
# override needed to keep the attachments' storing procedure # 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, def create_single_pdf(self, cursor, uid, ids, data, report_xml,
context=None): context=None):
"""generate the PDF""" """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/>. # 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. """Will launch age partner balance report.
This report is based on Open Invoice Report This report is based on Open Invoice Report
and share a lot of knowledge with him and share a lot of knowledge with him
""" """
# pylint: disable=consider-merging-classes-inherited
_inherit = "open.invoices.webkit" _inherit = "open.invoices.webkit"
_name = "aged.open.invoices.webkit" _name = "aged.open.invoices.webkit"
_description = "Aged open invoices" _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, def onchange_fiscalyear(self, cr, uid, ids, fiscalyear=False,
period_id=False, date_to=False, until_date=False, period_id=False, date_to=False, until_date=False,
context=None): context=None):
@ -53,6 +52,7 @@ class AgedOpenInvoice(orm.TransientModel):
}) })
return res return res
# pylint: disable=old-api7-method-defined
def _print_report(self, cr, uid, ids, data, context=None): def _print_report(self, cr, uid, ids, data, context=None):
# we update form with display account value # we update form with display account value
data = self.pre_print_report(cr, uid, ids, data, context=context) 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"> <record id="aged_open_invoice_webkit" model="ir.ui.view">
<field name="name">Aged Open Invoice Report</field> <field name="name">Aged Open Invoice Report</field>
<field name="model">aged.open.invoices.webkit</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="inherit_id" ref="account.account_common_report_view"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<data> <data>

33
account_financial_report_webkit/wizard/aged_partner_balance_wizard.py

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2014 Camptocamp SA, Nicolas Bessi. # Copyright 2014 Camptocamp SA, Nicolas Bessi.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # 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. """Will launch age partner balance report.
This report is based on Open Invoice Report This report is based on Open Invoice Report
and share a lot of knowledge with him and share a lot of knowledge with him
@ -14,27 +14,21 @@ class AccountAgedTrialBalance(orm.TransientModel):
_name = "account.aged.trial.balance.webkit" _name = "account.aged.trial.balance.webkit"
_description = "Aged partner balanced" _description = "Aged partner balanced"
# pylint: disable=old-api7-method-defined
def _get_current_fiscalyear(self, cr, uid, context=None): def _get_current_fiscalyear(self, cr, uid, context=None):
return self.pool['account.fiscalyear'].find(cr, uid, context=context) 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, def onchange_fiscalyear(self, cr, uid, ids, fiscalyear=False,
period_id=False, date_to=False, until_date=False, period_id=False, date_to=False, until_date=False,
context=None): context=None):
@ -51,6 +45,7 @@ class AccountAgedTrialBalance(orm.TransientModel):
}) })
return res return res
# pylint: disable=old-api7-method-defined
def _print_report(self, cr, uid, ids, data, context=None): def _print_report(self, cr, uid, ids, data, context=None):
# we update form with display account value # we update form with display account value
data = self.pre_print_report(cr, uid, ids, data, context=context) 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"> <record id="account_aged_trial_balance_webkit" model="ir.ui.view">
<field name="name">Aged Partner Balance Report</field> <field name="name">Aged Partner Balance Report</field>
<field name="model">account.aged.trial.balance.webkit</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="inherit_id" ref="account.account_common_report_view"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<data> <data>

54
account_financial_report_webkit/wizard/balance_common.py

@ -32,8 +32,10 @@ import time
from lxml import etree from lxml import etree
from datetime import datetime from datetime import datetime
from openerp.osv import fields, orm
from openerp import fields, models
from openerp.tools.translate import _ from openerp.tools.translate import _
# pylint: disable=deprecated-module
from openerp.osv.orm import setup_modifiers
def previous_year_date(date, nb_prev=1): def previous_year_date(date, nb_prev=1):
@ -46,10 +48,11 @@ def previous_year_date(date, nb_prev=1):
return previous_date return previous_date
class AccountBalanceCommonWizard(orm.TransientModel):
class AccountBalanceCommonWizard(models.TransientModel):
"""Will launch trial balance report and pass required args""" """Will launch trial balance report and pass required args"""
# pylint: disable=consider-merging-classes-inherited
_inherit = "account.common.account.report" _inherit = "account.common.account.report"
_name = "account.common.balance.report" _name = "account.common.balance.report"
_description = "Common Balance Report" _description = "Common Balance Report"
@ -74,6 +77,7 @@ class AccountBalanceCommonWizard(orm.TransientModel):
for index in range(COMPARISON_LEVEL)] for index in range(COMPARISON_LEVEL)]
DYNAMIC_FIELDS = M2O_DYNAMIC_FIELDS + SIMPLE_DYNAMIC_FIELDS DYNAMIC_FIELDS = M2O_DYNAMIC_FIELDS + SIMPLE_DYNAMIC_FIELDS
# pylint: disable=old-api7-method-defined
def _get_account_ids(self, cr, uid, context=None): def _get_account_ids(self, cr, uid, context=None):
res = False res = False
if context.get('active_model', False) == 'account.account' \ if context.get('active_model', False) == 'account.account' \
@ -81,48 +85,47 @@ class AccountBalanceCommonWizard(orm.TransientModel):
res = context['active_ids'] res = context['active_ids']
return res return res
_columns = {
'account_ids': fields.many2many(
account_ids = fields.Many2many(
'account.account', string='Filter on accounts', 'account.account', string='Filter on accounts',
help="Only selected accounts will be printed. Leave empty to \ help="Only selected accounts will be printed. Leave empty to \
print all accounts."),
'filter': fields.selection(
print all accounts.", default=lambda self: self._get_account_ids(),
)
filter = fields.Selection(
[('filter_no', 'No Filters'), [('filter_no', 'No Filters'),
('filter_date', 'Date'), ('filter_date', 'Date'),
('filter_period', 'Periods'), ('filter_period', 'Periods'),
('filter_opening', 'Opening Only')], ('filter_opening', 'Opening Only')],
"Filter by",
required=True,
"Filter by", required=True,
help='Filter by date: no opening balance will be displayed. ' help='Filter by date: no opening balance will be displayed. '
'(opening balance can only be computed based on period to be \ '(opening balance can only be computed based on period to be \
correct).'),
correct).'
)
# Set statically because of the impossibility of changing the selection # Set statically because of the impossibility of changing the selection
# field when changing chart_account_id # field when changing chart_account_id
'account_level': fields.selection(
account_level = fields.Selection(
[('1', '1'), ('2', '2'), ('3', '3'), ('4', '4'), ('5', '5'), [('1', '1'), ('2', '2'), ('3', '3'), ('4', '4'), ('5', '5'),
('6', '6')], string="Account level"),
}
('6', '6')], string="Account level"
)
# pylint: disable=attribute-deprecated
_columns = {}
for index in range(COMPARISON_LEVEL): for index in range(COMPARISON_LEVEL):
_columns.update( _columns.update(
{"comp%s_filter" % index: {"comp%s_filter" % index:
fields.selection(
fields.fields.selection(
COMPARE_SELECTION, string='Compare By', required=True), COMPARE_SELECTION, string='Compare By', required=True),
"comp%s_fiscalyear_id" % index: "comp%s_fiscalyear_id" % index:
fields.many2one('account.fiscalyear', 'Fiscal Year'),
fields.fields.many2one('account.fiscalyear', 'Fiscal Year'),
"comp%s_period_from" % index: "comp%s_period_from" % index:
fields.many2one('account.period', 'Start Period'),
fields.fields.many2one('account.period', 'Start Period'),
"comp%s_period_to" % index: "comp%s_period_to" % index:
fields.many2one('account.period', 'End Period'),
fields.fields.many2one('account.period', 'End Period'),
"comp%s_date_from" % index: "comp%s_date_from" % index:
fields.date("Start Date"),
fields.fields.date("Start Date"),
"comp%s_date_to" % index: "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): def _check_fiscalyear(self, cr, uid, ids, context=None):
obj = self.read( obj = self.read(
cr, uid, ids[0], ['fiscalyear_id', 'filter'], context=context) cr, uid, ids[0], ['fiscalyear_id', 'filter'], context=context)
@ -136,6 +139,7 @@ class AccountBalanceCommonWizard(orm.TransientModel):
periods or by date.', ['filter']), periods or by date.', ['filter']),
] ]
# pylint: disable=old-api7-method-defined
def default_get(self, cr, uid, fields, context=None): def default_get(self, cr, uid, fields, context=None):
""" """
To get default values for the object. To get default values for the object.
@ -157,6 +161,7 @@ class AccountBalanceCommonWizard(orm.TransientModel):
res[field] = 'filter_no' res[field] = 'filter_no'
return res return res
# pylint: disable=old-api7-method-defined
def fields_view_get(self, cr, uid, view_id=None, view_type='form', def fields_view_get(self, cr, uid, view_id=None, view_type='form',
context=None, toolbar=False, submenu=False): context=None, toolbar=False, submenu=False):
res = super(AccountBalanceCommonWizard, self).fields_view_get( res = super(AccountBalanceCommonWizard, self).fields_view_get(
@ -180,7 +185,7 @@ class AccountBalanceCommonWizard(orm.TransientModel):
page.append(group) page.append(group)
def modifiers_and_append(elem): def modifiers_and_append(elem):
orm.setup_modifiers(elem)
setup_modifiers(elem)
group.append(elem) group.append(elem)
modifiers_and_append(etree.Element( modifiers_and_append(etree.Element(
@ -244,6 +249,7 @@ class AccountBalanceCommonWizard(orm.TransientModel):
res['arch'] = etree.tostring(eview) res['arch'] = etree.tostring(eview)
return res return res
# pylint: disable=old-api7-method-defined
def onchange_filter(self, cr, uid, ids, filter='filter_no', def onchange_filter(self, cr, uid, ids, filter='filter_no',
fiscalyear_id=False, context=None): fiscalyear_id=False, context=None):
res = {} res = {}
@ -296,6 +302,7 @@ class AccountBalanceCommonWizard(orm.TransientModel):
end_period, 'date_from': False, 'date_to': False} end_period, 'date_from': False, 'date_to': False}
return res return res
# pylint: disable=old-api7-method-defined
def onchange_comp_filter(self, cr, uid, ids, index, def onchange_comp_filter(self, cr, uid, ids, index,
main_filter='filter_no', comp_filter='filter_no', main_filter='filter_no', comp_filter='filter_no',
fiscalyear_id=False, start_date=False, fiscalyear_id=False, start_date=False,
@ -390,6 +397,7 @@ class AccountBalanceCommonWizard(orm.TransientModel):
date_to_field: False} date_to_field: False}
return res return res
# pylint: disable=old-api7-method-defined
def pre_print_report(self, cr, uid, ids, data, context=None): def pre_print_report(self, cr, uid, ids, data, context=None):
data = super(AccountBalanceCommonWizard, self).pre_print_report( data = super(AccountBalanceCommonWizard, self).pre_print_report(
cr, uid, ids, data, context=context) cr, uid, ids, data, context=context)

52
account_financial_report_webkit/wizard/general_ledger_wizard.py

@ -1,4 +1,4 @@
# -*- encoding: utf-8 -*-
# -*- coding: utf-8 -*-
############################################################################## ##############################################################################
# #
# Author: Nicolas Bessi, Guewen Baconnier # Author: Nicolas Bessi, Guewen Baconnier
@ -20,11 +20,10 @@
############################################################################## ##############################################################################
import time 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""" """Will launch general ledger report and pass required args"""
@ -32,6 +31,7 @@ class AccountReportGeneralLedgerWizard(orm.TransientModel):
_name = "general.ledger.webkit" _name = "general.ledger.webkit"
_description = "General Ledger Report" _description = "General Ledger Report"
# pylint: disable=old-api7-method-defined
def _get_account_ids(self, cr, uid, context=None): def _get_account_ids(self, cr, uid, context=None):
res = False res = False
if context.get('active_model', False) == 'account.account' \ if context.get('active_model', False) == 'account.account' \
@ -39,30 +39,27 @@ class AccountReportGeneralLedgerWizard(orm.TransientModel):
res = context['active_ids'] res = context['active_ids']
return res 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(
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', '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,
}
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): def _check_fiscalyear(self, cr, uid, ids, context=None):
obj = self.read( obj = self.read(
cr, uid, ids[0], ['fiscalyear_id', 'filter'], context=context) cr, uid, ids[0], ['fiscalyear_id', 'filter'], context=context)
@ -76,6 +73,7 @@ class AccountReportGeneralLedgerWizard(orm.TransientModel):
periods or by date.', ['filter']), periods or by date.', ['filter']),
] ]
# pylint: disable=old-api7-method-defined
def pre_print_report(self, cr, uid, ids, data, context=None): def pre_print_report(self, cr, uid, ids, data, context=None):
data = super(AccountReportGeneralLedgerWizard, self).pre_print_report( data = super(AccountReportGeneralLedgerWizard, self).pre_print_report(
cr, uid, ids, data, context=context) cr, uid, ids, data, context=context)
@ -90,6 +88,7 @@ class AccountReportGeneralLedgerWizard(orm.TransientModel):
data['form'].update(vals) data['form'].update(vals)
return data return data
# pylint: disable=old-api7-method-defined
def onchange_filter(self, cr, uid, ids, filter='filter_no', def onchange_filter(self, cr, uid, ids, filter='filter_no',
fiscalyear_id=False, context=None): fiscalyear_id=False, context=None):
res = {} res = {}
@ -148,6 +147,7 @@ class AccountReportGeneralLedgerWizard(orm.TransientModel):
end_period, 'date_from': False, 'date_to': False} end_period, 'date_from': False, 'date_to': False}
return res return res
# pylint: disable=old-api7-method-defined
def _print_report(self, cursor, uid, ids, data, context=None): def _print_report(self, cursor, uid, ids, data, context=None):
# we update form with display account value # we update form with display account value
data = self.pre_print_report(cursor, uid, ids, data, context=context) 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"> <record id="account_report_general_ledger_view_webkit" model="ir.ui.view">
<field name="name">General Ledger</field> <field name="name">General Ledger</field>
<field name="model">general.ledger.webkit</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="inherit_id" ref="account.account_common_report_view"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<data> <data>

26
account_financial_report_webkit/wizard/open_invoices_wizard.py

@ -1,4 +1,4 @@
# -*- encoding: utf-8 -*-
# -*- coding: utf-8 -*-
############################################################################## ##############################################################################
# #
# Author: Guewen Baconnier # Author: Guewen Baconnier
@ -18,10 +18,10 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # 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""" """Will launch partner ledger report and pass required args"""
@ -29,13 +29,11 @@ class AccountReportOpenInvoicesWizard(orm.TransientModel):
_name = "open.invoices.webkit" _name = "open.invoices.webkit"
_description = "Open Invoices Report" _description = "Open Invoices Report"
_columns = {
'group_by_currency': fields.boolean('Group Partner by currency'),
'until_date': fields.date(
"Clearance date",
required=True,
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 help="""The clearance date is essentially a tool used for debtors
provisionning calculation.
provisionning calculation.
By default, this date is equal to the the end date (ie: 31/12/2011 if you By default, this date is equal to the the end date (ie: 31/12/2011 if you
select fy 2011). select fy 2011).
@ -43,8 +41,9 @@ select fy 2011).
By amending the clearance date, you will be, for instance, able to answer the 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 question : 'based on my last year end debtors open invoices, which invoices
are still unpaid today (today is my clearance date)?' 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 _check_until_date(self, cr, uid, ids, context=None):
def get_key_id(obj, field): def get_key_id(obj, field):
return obj.get(field) and obj[field][0] or False 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']), last period or later.', ['until_date']),
] ]
# pylint: disable=old-api7-method-defined
def default_until_date(self, cr, uid, ids, fiscalyear_id=False, def default_until_date(self, cr, uid, ids, fiscalyear_id=False,
period_id=False, date_to=False, context=None): period_id=False, date_to=False, context=None):
res_date = False res_date = False
@ -82,6 +82,7 @@ are still unpaid today (today is my clearance date)?'
context=context)['date_stop'] context=context)['date_stop']
return res_date return res_date
# pylint: disable=old-api7-method-defined
def onchange_fiscalyear(self, cr, uid, ids, fiscalyear=False, def onchange_fiscalyear(self, cr, uid, ids, fiscalyear=False,
period_id=False, date_to=False, until_date=False, period_id=False, date_to=False, until_date=False,
context=None): context=None):
@ -94,6 +95,7 @@ are still unpaid today (today is my clearance date)?'
context=context) context=context)
return res return res
# pylint: disable=old-api7-method-defined
def onchange_date_to(self, cr, uid, ids, fiscalyear=False, period_id=False, def onchange_date_to(self, cr, uid, ids, fiscalyear=False, period_id=False,
date_to=False, until_date=False, context=None): date_to=False, until_date=False, context=None):
res = {'value': {}} res = {'value': {}}
@ -105,6 +107,7 @@ are still unpaid today (today is my clearance date)?'
context=context) context=context)
return res return res
# pylint: disable=old-api7-method-defined
def onchange_period_to(self, cr, uid, ids, fiscalyear=False, def onchange_period_to(self, cr, uid, ids, fiscalyear=False,
period_id=False, date_to=False, until_date=False, period_id=False, date_to=False, until_date=False,
context=None): context=None):
@ -117,6 +120,7 @@ are still unpaid today (today is my clearance date)?'
context=context) context=context)
return res return res
# pylint: disable=old-api7-method-defined
def onchange_filter(self, cr, uid, ids, filter='filter_no', def onchange_filter(self, cr, uid, ids, filter='filter_no',
fiscalyear_id=False, context=None): fiscalyear_id=False, context=None):
res = super(AccountReportOpenInvoicesWizard, self).onchange_filter( res = super(AccountReportOpenInvoicesWizard, self).onchange_filter(
@ -131,6 +135,7 @@ are still unpaid today (today is my clearance date)?'
context=context) context=context)
return res return res
# pylint: disable=old-api7-method-defined
def pre_print_report(self, cr, uid, ids, data, context=None): def pre_print_report(self, cr, uid, ids, data, context=None):
data = super(AccountReportOpenInvoicesWizard, self).pre_print_report( data = super(AccountReportOpenInvoicesWizard, self).pre_print_report(
cr, uid, ids, data, context=context) cr, uid, ids, data, context=context)
@ -140,6 +145,7 @@ are still unpaid today (today is my clearance date)?'
data['form'].update(vals) data['form'].update(vals)
return data return data
# pylint: disable=old-api7-method-defined
def _print_report(self, cr, uid, ids, data, context=None): def _print_report(self, cr, uid, ids, data, context=None):
# we update form with display account value # we update form with display account value
data = self.pre_print_report(cr, uid, ids, data, context=context) 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"> <record id="account_open_invoices_view_webkit" model="ir.ui.view">
<field name="name">Open Invoices Report</field> <field name="name">Open Invoices Report</field>
<field name="model">open.invoices.webkit</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="inherit_id" ref="account.account_common_report_view"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<data> <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""" """Will launch partner balance report and pass required args"""
# pylint: disable=consider-merging-classes-inherited
_inherit = "account.common.balance.report" _inherit = "account.common.balance.report"
_name = "partner.balance.webkit" _name = "partner.balance.webkit"
_description = "Partner Balance Report" _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"> <record id="account_partner_balance_view_webkit" model="ir.ui.view">
<field name="name">Partner Balance</field> <field name="name">Partner Balance</field>
<field name="model">partner.balance.webkit</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="inherit_id" ref="account.account_common_report_view"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<data> <data>

40
account_financial_report_webkit/wizard/partners_ledger_wizard.py

@ -1,4 +1,4 @@
# -*- encoding: utf-8 -*-
# -*- coding: utf-8 -*-
############################################################################## ##############################################################################
# #
# Author: Nicolas Bessi, Guewen Baconnier # Author: Nicolas Bessi, Guewen Baconnier
@ -19,11 +19,10 @@
# #
############################################################################## ##############################################################################
import time 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""" """Will launch partner ledger report and pass required args"""
@ -31,27 +30,25 @@ class AccountReportPartnersLedgerWizard(orm.TransientModel):
_name = "partners.ledger.webkit" _name = "partners.ledger.webkit"
_description = "Partner Ledger Report" _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(
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_no', 'No Filters'),
('filter_date', 'Date'), ('filter_date', 'Date'),
('filter_period', 'Periods')], "Filter by", required=True, ('filter_period', 'Periods')], "Filter by", required=True,
help='Filter by date: no opening balance will be displayed. ' 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',
}
'(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): def _check_fiscalyear(self, cr, uid, ids, context=None):
obj = self.read( obj = self.read(
cr, uid, ids[0], ['fiscalyear_id', 'filter'], context=context) cr, uid, ids[0], ['fiscalyear_id', 'filter'], context=context)
@ -66,6 +63,7 @@ class AccountReportPartnersLedgerWizard(orm.TransientModel):
['filter']), ['filter']),
] ]
# pylint: disable=old-api7-method-defined
def onchange_filter(self, cr, uid, ids, filter='filter_no', def onchange_filter(self, cr, uid, ids, filter='filter_no',
fiscalyear_id=False, context=None): fiscalyear_id=False, context=None):
res = {} res = {}
@ -119,6 +117,7 @@ class AccountReportPartnersLedgerWizard(orm.TransientModel):
end_period, 'date_from': False, 'date_to': False} end_period, 'date_from': False, 'date_to': False}
return res return res
# pylint: disable=old-api7-method-defined
def pre_print_report(self, cr, uid, ids, data, context=None): def pre_print_report(self, cr, uid, ids, data, context=None):
data = super(AccountReportPartnersLedgerWizard, self).pre_print_report( data = super(AccountReportPartnersLedgerWizard, self).pre_print_report(
cr, uid, ids, data, context=context) cr, uid, ids, data, context=context)
@ -132,6 +131,7 @@ class AccountReportPartnersLedgerWizard(orm.TransientModel):
data['form'].update(vals) data['form'].update(vals)
return data return data
# pylint: disable=old-api7-method-defined
def _print_report(self, cursor, uid, ids, data, context=None): def _print_report(self, cursor, uid, ids, data, context=None):
# we update form with display account value # we update form with display account value
data = self.pre_print_report(cursor, uid, ids, data, context=context) 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"> <record id="account_partner_ledger_view_webkit" model="ir.ui.view">
<field name="name">Partner Ledger</field> <field name="name">Partner Ledger</field>
<field name="model">partners.ledger.webkit</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="inherit_id" ref="account.account_common_report_view"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<data> <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/>. # 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 import time
class AccountReportPrintJournalWizard(orm.TransientModel):
class AccountReportPrintJournalWizard(models.TransientModel):
"""Will launch print journal report and pass requiered args""" """Will launch print journal report and pass requiered args"""
# pylint: disable=consider-merging-classes-inherited
_inherit = "account.common.account.report" _inherit = "account.common.account.report"
_name = "print.journal.webkit" _name = "print.journal.webkit"
_description = "Journals Report" _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): def _check_fiscalyear(self, cr, uid, ids, context=None):
obj = self.read(cr, uid, ids[0], ['fiscalyear_id', 'filter'], obj = self.read(cr, uid, ids[0], ['fiscalyear_id', 'filter'],
context=context) context=context)
@ -57,6 +52,7 @@ class AccountReportPrintJournalWizard(orm.TransientModel):
to filter by periods or by date.', ['filter']), 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): def pre_print_report(self, cr, uid, ids, data, context=None):
data = super(AccountReportPrintJournalWizard, self).\ data = super(AccountReportPrintJournalWizard, self).\
pre_print_report(cr, uid, ids, data, context=context) pre_print_report(cr, uid, ids, data, context=context)
@ -70,6 +66,7 @@ class AccountReportPrintJournalWizard(orm.TransientModel):
data['form'].update(vals) data['form'].update(vals)
return data return data
# pylint: disable=old-api7-method-defined
def onchange_filter(self, cr, uid, ids, filter='filter_no', def onchange_filter(self, cr, uid, ids, filter='filter_no',
fiscalyear_id=False, context=None): fiscalyear_id=False, context=None):
res = {} res = {}
@ -122,6 +119,7 @@ class AccountReportPrintJournalWizard(orm.TransientModel):
end_period, 'date_from': False, 'date_to': False} end_period, 'date_from': False, 'date_to': False}
return res return res
# pylint: disable=old-api7-method-defined
def _print_report(self, cursor, uid, ids, data, context=None): def _print_report(self, cursor, uid, ids, data, context=None):
context = context or {} context = context or {}
# we update form with display account value # 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="name">Journals</field>
<field name="model">print.journal.webkit</field> <field name="model">print.journal.webkit</field>
<field name="type">form</field> <field name="type">form</field>
<field name="priority">99</field>
<field name="inherit_id" ref="account.account_common_report_view"/> <field name="inherit_id" ref="account.account_common_report_view"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<data> <data>

8
account_financial_report_webkit/wizard/trial_balance_wizard.py

@ -1,4 +1,4 @@
# -*- encoding: utf-8 -*-
# -*- coding: utf-8 -*-
############################################################################## ##############################################################################
# #
# Author: Guewen Baconnier # Author: Guewen Baconnier
@ -18,17 +18,17 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # 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""" """Will launch trial balance report and pass required args"""
_inherit = "account.common.balance.report" _inherit = "account.common.balance.report"
_name = "trial.balance.webkit" _name = "trial.balance.webkit"
_description = "Trial Balance Report" _description = "Trial Balance Report"
# pylint: disable=old-api7-method-defined
def _print_report(self, cursor, uid, ids, data, context=None): def _print_report(self, cursor, uid, ids, data, context=None):
context = context or {} context = context or {}
# we update form with display account value # 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"> <record id="account_trial_balance_view_webkit" model="ir.ui.view">
<field name="name">Trial Balance</field> <field name="name">Trial Balance</field>
<field name="model">trial.balance.webkit</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="inherit_id" ref="account.account_common_report_view"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<data> <data>

1
account_financial_report_webkit_xls/__openerp__.py

@ -23,6 +23,5 @@
'test/trial_balance.yml', 'test/trial_balance.yml',
'test/partner_balance.yml', 'test/partner_balance.yml',
'test/open_invoices.yml'], 'test/open_invoices.yml'],
'active': False,
'installable': True, '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): class AccountAgedOpenInvoicesWebkitXls(report_xls):
# pylint: disable=old-api7-method-defined
def create(self, cr, uid, ids, data, context=None): def create(self, cr, uid, ids, data, context=None):
self._column_sizes = [ self._column_sizes = [
30, # Partner 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): class AccountAgedTrialBalanceWebkitXls(report_xls):
# pylint: disable=old-api7-method-defined
def create(self, cr, uid, ids, data, context=None): def create(self, cr, uid, ids, data, context=None):
self._column_sizes = [ self._column_sizes = [
30, # Partner 30, # Partner

4
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] column_sizes = [x[1] for x in _column_sizes]
def generate_xls_report(self, _p, _xs, data, objects, wb): def generate_xls_report(self, _p, _xs, data, objects, wb):
@ -327,6 +327,6 @@ class general_ledger_xls(report_xls):
row_pos += 1 row_pos += 1
general_ledger_xls('report.account.account_report_general_ledger_xls',
GeneralLedgerXls('report.account.account_report_general_ledger_xls',
'account.account', 'account.account',
parser=GeneralLedgerWebkit) parser=GeneralLedgerWebkit)

4
account_financial_report_webkit_xls/report/open_invoices_xls.py

@ -12,7 +12,7 @@ from openerp.tools.translate import _
# _logger = logging.getLogger(__name__) # _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] 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): def global_initializations(self, wb, _p, xlwt, _xs, objects, data):
@ -806,5 +806,5 @@ class open_invoices_xls(report_xls):
row_pos += 1 row_pos += 1
open_invoices_xls('report.account.account_report_open_invoices_xls',
OpenInvoicesXls('report.account.account_report_open_invoices_xls',
'account.account', parser=PartnersOpenInvoicesWebkit) 'account.account', parser=PartnersOpenInvoicesWebkit)

4
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] column_sizes = [x[1] for x in _column_sizes]
def generate_xls_report(self, _p, _xs, data, objects, wb): def generate_xls_report(self, _p, _xs, data, objects, wb):
@ -438,6 +438,6 @@ class partner_ledger_xls(report_xls):
row_pos += 2 row_pos += 2
partner_ledger_xls('report.account.account_report_partner_ledger_xls',
PartnerLedgerXls('report.account.account_report_partner_ledger_xls',
'account.account', 'account.account',
parser=PartnersLedgerWebkit) parser=PartnersLedgerWebkit)

4
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]) 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] column_sizes = [12, 40, 25, 17, 17, 17, 17, 17]
def print_title(self, ws, _p, row_position, xlwt, _xs): 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) _xs, xlwt, ws, row_account_start, row_pos, current_account, _p)
partners_balance_xls('report.account.account_report_partner_balance_xls',
PartnersBalanceXls('report.account.account_report_partner_balance_xls',
'account.account', 'account.account',
parser=PartnerBalanceWebkit) 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): class TrialBalanceXls(report_xls):
# pylint: disable=old-api7-method-defined
def create(self, cr, uid, ids, data, context=None): def create(self, cr, uid, ids, data, context=None):
self._column_sizes = [12, 60, 17, 17, 17, 17, 17, 17] self._column_sizes = [12, 60, 17, 17, 17, 17, 17, 17]
self._debit_pos = 4 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): class AgedOpenInvoice(models.TransientModel):
_inherit = 'aged.open.invoices.webkit' _inherit = 'aged.open.invoices.webkit'
# pylint: disable=old-api7-method-defined
def xls_export(self, cr, uid, ids, context=None): def xls_export(self, cr, uid, ids, context=None):
return self.check_report(cr, uid, ids, context=context) 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): def _print_report(self, cr, uid, ids, data, context=None):
context = context or {} context = context or {}
if context.get('xls_export'): 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): class AccountAgedTrialBalance(models.TransientModel):
_inherit = 'account.aged.trial.balance.webkit' _inherit = 'account.aged.trial.balance.webkit'
# pylint: disable=old-api7-method-defined
def xls_export(self, cr, uid, ids, context=None): def xls_export(self, cr, uid, ids, context=None):
return self.check_report(cr, uid, ids, context=context) 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): def _print_report(self, cr, uid, ids, data, context=None):
context = context or {} context = context or {}
if context.get('xls_export'): 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): class AccountReportGeneralLedgerWizard(models.TransientModel):
_inherit = 'general.ledger.webkit' _inherit = 'general.ledger.webkit'
# pylint: disable=old-api7-method-defined
def xls_export(self, cr, uid, ids, context=None): def xls_export(self, cr, uid, ids, context=None):
return self.check_report(cr, uid, ids, context=context) 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): def _print_report(self, cr, uid, ids, data, context=None):
context = context or {} context = context or {}
if context.get('xls_export'): 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"> <record id="account_report_general_ledger_view_webkit" model="ir.ui.view">
<field name="name">general.ledger.webkit.xls</field> <field name="name">general.ledger.webkit.xls</field>
<field name="model">general.ledger.webkit</field> <field name="model">general.ledger.webkit</field>
<field name="priority">99</field>
<field name="type">form</field> <field name="type">form</field>
<field name="inherit_id" ref="account_financial_report_webkit.account_report_general_ledger_view_webkit"/> <field name="inherit_id" ref="account_financial_report_webkit.account_report_general_ledger_view_webkit"/>
<field name="arch" type="xml"> <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): class AccountReportOpenInvoicesWizard(models.TransientModel):
_inherit = 'open.invoices.webkit' _inherit = 'open.invoices.webkit'
# pylint: disable=old-api7-method-defined
def xls_export(self, cr, uid, ids, context=None): def xls_export(self, cr, uid, ids, context=None):
return self.check_report(cr, uid, ids, context=context) 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): def _print_report(self, cr, uid, ids, data, context=None):
context = context or {} context = context or {}
if context.get('xls_export'): 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"> <record id="account_open_invoices_view_webkit" model="ir.ui.view">
<field name="name">open.invoices.webkit.xls</field> <field name="name">open.invoices.webkit.xls</field>
<field name="model">open.invoices.webkit</field> <field name="model">open.invoices.webkit</field>
<field name="priority">99</field>
<field name="type">form</field> <field name="type">form</field>
<field name="inherit_id" ref="account_financial_report_webkit.account_open_invoices_view_webkit"/> <field name="inherit_id" ref="account_financial_report_webkit.account_open_invoices_view_webkit"/>
<field name="arch" type="xml"> <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): class AccountPartnerBalanceWizard(models.TransientModel):
_inherit = 'partner.balance.webkit' _inherit = 'partner.balance.webkit'
# pylint: disable=old-api7-method-defined
def xls_export(self, cr, uid, ids, context=None): def xls_export(self, cr, uid, ids, context=None):
return self.check_report(cr, uid, ids, context=context) 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): def _print_report(self, cr, uid, ids, data, context=None):
context = context or {} context = context or {}
if context.get('xls_export'): 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): class AccountReportPartnersLedgerWizard(models.TransientModel):
_inherit = 'partners.ledger.webkit' _inherit = 'partners.ledger.webkit'
# pylint: disable=old-api7-method-defined
def xls_export(self, cr, uid, ids, context=None): def xls_export(self, cr, uid, ids, context=None):
return self.check_report(cr, uid, ids, context=context) 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): def _print_report(self, cr, uid, ids, data, context=None):
context = context or {} context = context or {}
if context.get('xls_export'): 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"> <record id="account_partner_ledger_view_webkit" model="ir.ui.view">
<field name="name">partners.ledger.webkit.xls</field> <field name="name">partners.ledger.webkit.xls</field>
<field name="model">partners.ledger.webkit</field> <field name="model">partners.ledger.webkit</field>
<field name="priority">99</field>
<field name="type">form</field> <field name="type">form</field>
<field name="inherit_id" ref="account_financial_report_webkit.account_partner_ledger_view_webkit"/> <field name="inherit_id" ref="account_financial_report_webkit.account_partner_ledger_view_webkit"/>
<field name="arch" type="xml"> <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): class AccountTrialBalanceWizard(models.TransientModel):
_inherit = 'trial.balance.webkit' _inherit = 'trial.balance.webkit'
# pylint: disable=old-api7-method-defined
def xls_export(self, cr, uid, ids, context=None): def xls_export(self, cr, uid, ids, context=None):
return self.check_report(cr, uid, ids, context=context) 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): def _print_report(self, cr, uid, ids, data, context=None):
context = context or {} context = context or {}
if context.get('xls_export'): 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"> <record id="account_trial_balance_view_webkit" model="ir.ui.view">
<field name="name">trial.balance.webkit.xls</field> <field name="name">trial.balance.webkit.xls</field>
<field name="model">trial.balance.webkit</field> <field name="model">trial.balance.webkit</field>
<field name="priority">99</field>
<field name="type">form</field> <field name="type">form</field>
<field name="inherit_id" ref="account_financial_report_webkit.account_trial_balance_view_webkit"/> <field name="inherit_id" ref="account_financial_report_webkit.account_trial_balance_view_webkit"/>
<field name="arch" type="xml"> <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 # 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 # OpenERP, Open Source Management Solution
@ -19,14 +19,14 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # 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' _inherit = 'account.journal'
# allow inherited modules to extend the query # allow inherited modules to extend the query
# pylint: disable=old-api7-method-defined
def _report_xls_query_extra(self, cr, uid, context=None): def _report_xls_query_extra(self, cr, uid, context=None):
select_extra = "" select_extra = ""
join_extra = "" join_extra = ""
@ -34,10 +34,12 @@ class account_journal(orm.Model):
return (select_extra, join_extra, where_extra) return (select_extra, join_extra, where_extra)
# allow inherited modules to add document references # allow inherited modules to add document references
# pylint: disable=old-api7-method-defined
def _report_xls_document_extra(self, cr, uid, context): def _report_xls_document_extra(self, cr, uid, context):
return "''" return "''"
# override list in inherited module to add/drop columns or change order # 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): def _report_xls_fields(self, cr, uid, context=None):
res = [ res = [
'move_name', # account.move,name 'move_name', # account.move,name
@ -73,6 +75,7 @@ class account_journal(orm.Model):
return res return res
# Change/Add Template entries # Change/Add Template entries
# pylint: disable=old-api7-method-defined
def _report_xls_template(self, cr, uid, context=None): def _report_xls_template(self, cr, uid, context=None):
""" """
Template updates, e.g. 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' _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): def set_context(self, objects, data, ids, report_type=None):
# _logger.warn('set_context, objects = %s, data = %s, # _logger.warn('set_context, objects = %s, data = %s,
# ids = %s', objects, data, ids) # 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') j_obj = self.pool.get('account.journal')
p_obj = self.pool.get('account.period') p_obj = self.pool.get('account.period')
fy_obj = self.pool.get('account.fiscalyear') fy_obj = self.pool.get('account.fiscalyear')
@ -48,10 +48,11 @@ class nov_journal_print(report_sxw.rml_parse):
objects.append((journal, fiscalyear)) objects.append((journal, fiscalyear))
self.localcontext['objects'] = self.objects = objects self.localcontext['objects'] = self.objects = objects
# pylint: disable=old-api7-method-defined
def __init__(self, cr, uid, name, context): def __init__(self, cr, uid, name, context):
if context is None: if context is None:
context = {} context = {}
super(nov_journal_print, self).__init__(cr, uid, name, context=context)
super(NovJournalPrint, self).__init__(cr, uid, name, context=context)
self.localcontext.update({ self.localcontext.update({
'time': time, 'time': time,
'title': self._title, 'title': self._title,
@ -121,6 +122,7 @@ class nov_journal_print(report_sxw.rml_parse):
# field value translations. # field value translations.
# If performance is no issue, you can adapt the _report_xls_template in # If performance is no issue, you can adapt the _report_xls_template in
# an inherited module to add field value translations. # 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, " self.cr.execute("SELECT l.move_id AS move_id, l.id AS aml_id, "
"am.name AS move_name, " "am.name AS move_name, "
"coalesce(am.ref,'') AS move_ref, " "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( code_string = j_obj._report_xls_document_extra(
self.cr, self.uid, self.context) self.cr, self.uid, self.context)
# _logger.warn('code_string= %s', code_string) # _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 # code_string comes from python module
# pylint: disable=eval-referenced
[x.update( [x.update(
{'docname': eval(code_string) or '-'}) # pylint: disable=W0123 {'docname': eval(code_string) or '-'}) # pylint: disable=W0123
for x in lines] for x in lines]
@ -307,6 +310,7 @@ class nov_journal_print(report_sxw.rml_parse):
else: else:
fiscalyear = object[1] fiscalyear = object[1]
period_ids = [x.id for x in fiscalyear.period_ids] period_ids = [x.id for x in fiscalyear.period_ids]
# pylint: disable=sql-injection
select = "SELECT sum(" + field + ") FROM account_move_line l " \ select = "SELECT sum(" + field + ") FROM account_move_line l " \
"INNER JOIN account_move am ON l.move_id = am.id " \ "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" "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: if isinstance(value, (float, int)) and not value:
return '' return ''
else: else:
return super(nov_journal_print, self).formatLang(
return super(NovJournalPrint, self).formatLang(
value, digits, value, digits,
date, date_time, grouping, monetary, dp, currency_obj) 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_sxw.report_sxw(
'report.nov.account.journal.print', 'account.journal', 'report.nov.account.journal.print', 'account.journal',
'addons/account_journal_report_xls/report/nov_account_journal.rml', 'addons/account_journal_report_xls/report/nov_account_journal.rml',
parser=nov_journal_print, header=False)
parser=NovJournalPrint, header=False)

28
account_journal_report_xls/report/nov_account_journal_xls.py

@ -4,20 +4,21 @@
import xlwt import xlwt
from datetime import datetime from datetime import datetime
from openerp.osv import orm
from openerp.addons.report_xls.report_xls import report_xls from openerp.addons.report_xls.report_xls import report_xls
from openerp.addons.report_xls.utils import rowcol_to_cell, _render from openerp.addons.report_xls.utils import rowcol_to_cell, _render
from .nov_account_journal import nov_journal_print from .nov_account_journal import nov_journal_print
from openerp.tools.translate import _ from openerp.tools.translate import _
from openerp.exceptions import except_orm
import logging import logging
_logger = logging.getLogger(__name__) _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): 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') journal_obj = self.pool.get('account.journal')
self.context = context self.context = context
wanted_list = journal_obj._report_xls_fields(cr, uid, 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, def __init__(self, name, table, rml=False, parser=False, header=True,
store=False): store=False):
super(account_journal_xls, self).__init__(
super(AccountJournalXls, self).__init__(
name, table, rml, parser, header, store) name, table, rml, parser, header, store)
# Cell Styles # Cell Styles
@ -305,7 +307,7 @@ class account_journal_xls(report_xls):
cols_number = len(wanted_list) cols_number = len(wanted_list)
vat_summary_cols_number = len(vat_summary_wanted_list) vat_summary_cols_number = len(vat_summary_wanted_list)
if vat_summary_cols_number > cols_number: if vat_summary_cols_number > cols_number:
raise orm.except_orm(
raise except_orm(
_('Programming Error!'), _('Programming Error!'),
_("vat_summary_cols_number should be < cols_number !")) _("vat_summary_cols_number should be < cols_number !"))
index = 0 index = 0
@ -360,10 +362,12 @@ class account_journal_xls(report_xls):
'credit') 'credit')
if not (self.credit_pos and self.debit_pos) and 'balance' \ if not (self.credit_pos and self.debit_pos) and 'balance' \
in wanted_list: in wanted_list:
raise orm.except_orm(_('Customisation Error!'),
raise except_orm(
_('Customisation Error!'),
_("The 'Balance' field is a calculated XLS \ _("The 'Balance' field is a calculated XLS \
field requiring the presence of the \ field requiring the presence of the \
'Debit' and 'Credit' fields !"))
'Debit' and 'Credit' fields !")
)
for o in objects: 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) 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,
)

38
account_journal_report_xls/wizard/print_journal_wizard.py

@ -1,4 +1,4 @@
# -*- encoding: utf-8 -*-
# -*- coding: utf-8 -*-
############################################################################## ##############################################################################
# #
# OpenERP, Open Source Management Solution # OpenERP, Open Source Management Solution
@ -19,37 +19,34 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # 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 \ from openerp.addons.account.wizard.account_report_common_journal \
import account_common_journal_report import account_common_journal_report
import logging import logging
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)
class account_print_journal_xls(orm.TransientModel):
class AccountPrintJournalXls(models.TransientModel):
_inherit = 'account.print.journal' _inherit = 'account.print.journal'
_name = 'account.print.journal.xls' _name = 'account.print.journal.xls'
_description = 'Print/Export Journal' _description = 'Print/Export Journal'
_columns = {
'journal_ids': fields.many2many(
journal_ids = fields.Many2many(
'account.journal', 'account.journal',
'account_print_journal_xls_journal_rel', 'account_print_journal_xls_journal_rel',
'journal_xls_id', 'journal_xls_id',
'journal_id', 'journal_id',
string='Journals', string='Journals',
required=True),
'group_entries': fields.boolean(
'Group Entries',
help="Group entries with same General Account & Tax Code."),
}
_defaults = {
'group_entries': True,
}
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): 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) cr, uid, fields, context)
if context.get('print_by') == 'fiscalyear': if context.get('print_by') == 'fiscalyear':
if 'fiscalyear_id' in res: if 'fiscalyear_id' in res:
@ -65,6 +62,7 @@ class account_print_journal_xls(orm.TransientModel):
res['period_to']['required'] = True res['period_to']['required'] = True
return res return res
# pylint: disable=old-api7-method-defined
def fy_period_ids(self, cr, uid, fiscalyear_id): def fy_period_ids(self, cr, uid, fiscalyear_id):
""" returns all periods from a fiscalyear sorted by date """ """ returns all periods from a fiscalyear sorted by date """
fy_period_ids = [] fy_period_ids = []
@ -78,6 +76,7 @@ class account_print_journal_xls(orm.TransientModel):
fy_period_ids = [x[0] for x in res] fy_period_ids = [x[0] for x in res]
return fy_period_ids return fy_period_ids
# pylint: disable=old-api7-method-defined
def onchange_fiscalyear_id(self, cr, uid, ids, fiscalyear_id=False, def onchange_fiscalyear_id(self, cr, uid, ids, fiscalyear_id=False,
context=None): context=None):
res = {'value': {}} res = {'value': {}}
@ -89,6 +88,7 @@ class account_print_journal_xls(orm.TransientModel):
res['value']['period_to'] = fy_period_ids[-1] res['value']['period_to'] = fy_period_ids[-1]
return res return res
# pylint: disable=old-api7-method-defined
def fields_view_get(self, cr, uid, view_id=None, view_type='form', def fields_view_get(self, cr, uid, view_id=None, view_type='form',
context=None, toolbar=False, submenu=False): context=None, toolbar=False, submenu=False):
""" skip account.common.journal.report,fields_view_get """ 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, fields_view_get(cr, uid, view_id, view_type, context, toolbar,
submenu) submenu)
# pylint: disable=old-api7-method-defined
def xls_export(self, cr, uid, ids, context=None): def xls_export(self, cr, uid, ids, context=None):
return self.print_report(cr, uid, ids, context=context) return self.print_report(cr, uid, ids, context=context)
# pylint: disable=old-api7-method-defined
def print_report(self, cr, uid, ids, context=None): def print_report(self, cr, uid, ids, context=None):
if context is None: if context is None:
context = {} context = {}
@ -156,7 +158,7 @@ class account_print_journal_xls(orm.TransientModel):
if aml_ids: if aml_ids:
journal_fy_ids.append((journal_id, fiscalyear_id)) journal_fy_ids.append((journal_id, fiscalyear_id))
if not journal_fy_ids: if not journal_fy_ids:
raise orm.except_orm(
raise exceptions.except_orm(
_('No Data Available'), _('No Data Available'),
_('No records found for your selection!')) _('No records found for your selection!'))
datas.update({ datas.update({
@ -180,7 +182,7 @@ class account_print_journal_xls(orm.TransientModel):
if period_ids: if period_ids:
journal_period_ids.append((journal_id, period_ids)) journal_period_ids.append((journal_id, period_ids))
if not journal_period_ids: if not journal_period_ids:
raise orm.except_orm(
raise exceptions.except_orm(
_('No Data Available'), _('No Data Available'),
_('No records found for your selection!')) _('No records found for your selection!'))
datas.update({ datas.update({

2
account_journal_report_xls/wizard/print_journal_wizard.xml

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<openerp> <openerp>
<data> <data>
<record id="view_print_journal_xls" model="ir.ui.view"> <record id="view_print_journal_xls" model="ir.ui.view">
<field name="name">Print/Export Journals</field> <field name="name">Print/Export Journals</field>
<field name="model">account.print.journal.xls</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="inherit_id" ref="account.account_common_report_view"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<data> <data>

Loading…
Cancel
Save