From 7c0a04744e89e28e58523b7b3c4a34d1024ab566 Mon Sep 17 00:00:00 2001 From: Anthony Muschang Date: Thu, 9 Oct 2014 17:34:48 +0200 Subject: [PATCH] [CHG] Migration to v8 --- .../__openerp__.py | 2 +- account_financial_report_webkit/account.py | 2 +- .../report/general_ledger.py | 22 ++++++++------- .../report/open_invoices.py | 4 +-- .../report/partners_ledger.py | 27 ++++++++++++------- .../account_report_general_ledger.mako | 18 ++++++------- .../account_report_partner_balance.mako | 2 +- .../account_report_partners_ledger.mako | 18 ++++++------- .../report/templates/aged_trial_webkit.mako | 2 +- ..._by_curr_open_invoices_inclusion.mako.html | 4 +-- .../open_invoices_inclusion.mako.html | 6 ++--- .../report/webkit_parser_header_fix.py | 18 ++++++------- .../tests/aged_trial_balance.yml | 10 +++---- .../tests/general_ledger.yml | 12 ++++----- .../tests/open_invoices.yml | 10 +++---- .../tests/partner_balance.yml | 12 ++++----- .../tests/partner_ledger.yml | 10 +++---- .../tests/trial_balance.yml | 12 ++++----- 18 files changed, 101 insertions(+), 90 deletions(-) diff --git a/account_financial_report_webkit/__openerp__.py b/account_financial_report_webkit/__openerp__.py index 38a374be..22de6562 100644 --- a/account_financial_report_webkit/__openerp__.py +++ b/account_financial_report_webkit/__openerp__.py @@ -202,6 +202,6 @@ wkhtmltopdf. The texts are defined inside the report classes. 'tests/aged_trial_balance.yml'], # 'tests/account_move_line.yml' 'active': False, - 'installable': False, + 'installable': True, 'application': True, } diff --git a/account_financial_report_webkit/account.py b/account_financial_report_webkit/account.py index 97a63797..4e1118ee 100644 --- a/account_financial_report_webkit/account.py +++ b/account_financial_report_webkit/account.py @@ -39,7 +39,7 @@ class AccountAccount(orm.Model): 'Centralized', help="If flagged, no details will be displayed in " "the General Ledger report (the webkit one only), " - "only centralized amounts per period.") + "only centralized amounts per period."), } _defaults = { diff --git a/account_financial_report_webkit/report/general_ledger.py b/account_financial_report_webkit/report/general_ledger.py index 0f62a270..df7e60bf 100644 --- a/account_financial_report_webkit/report/general_ledger.py +++ b/account_financial_report_webkit/report/general_ledger.py @@ -119,20 +119,22 @@ class GeneralLedgerWebkit(report_sxw.rml_parse, CommonReportHeaderWebkit): ledger_lines_memoizer = self._compute_account_ledger_lines( accounts, init_balance_memoizer, main_filter, target_move, start, stop) - objects = [] - for account in self.pool.get('account.account').browse(self.cursor, - self.uid, - accounts): + objects = self.pool.get('account.account').browse(self.cursor, + self.uid, + accounts) + + init_balance = {} + ledger_lines = {} + for account in objects: if do_centralize and account.centralized \ and ledger_lines_memoizer.get(account.id): - account.ledger_lines = self._centralize_lines( + ledger_lines[account.id] = self._centralize_lines( main_filter, ledger_lines_memoizer.get(account.id, [])) else: - account.ledger_lines = ledger_lines_memoizer.get( + ledger_lines[account.id] = ledger_lines_memoizer.get( account.id, []) - account.init_balance = init_balance_memoizer.get(account.id, {}) - - objects.append(account) + init_balance[account.id] = init_balance_memoizer.get(account.id, + {}) self.localcontext.update({ 'fiscalyear': fiscalyear, @@ -142,6 +144,8 @@ class GeneralLedgerWebkit(report_sxw.rml_parse, CommonReportHeaderWebkit): 'stop_period': stop_period, 'chart_account': chart_account, 'initial_balance_mode': initial_balance_mode, + 'init_balance': init_balance, + 'ledger_lines': ledger_lines, }) return super(GeneralLedgerWebkit, self).set_context( diff --git a/account_financial_report_webkit/report/open_invoices.py b/account_financial_report_webkit/report/open_invoices.py index 4e58d4ad..ace849ee 100644 --- a/account_financial_report_webkit/report/open_invoices.py +++ b/account_financial_report_webkit/report/open_invoices.py @@ -26,7 +26,6 @@ from operator import itemgetter from mako.template import Template -import openerp.addons from openerp import pooler from openerp.osv import osv from openerp.report import report_sxw @@ -34,10 +33,11 @@ from openerp.tools.translate import _ from openerp.addons.report_webkit import report_helper from .common_partner_reports import CommonPartnersReportHeaderWebkit from .webkit_parser_header_fix import HeaderFooterTextWebKitParser +from openerp.modules.module import get_module_resource def get_mako_template(obj, *args): - template_path = openerp.addons.get_module_resource(*args) + template_path = get_module_resource(*args) return Template(filename=template_path, input_encoding='utf-8') report_helper.WebKitHelper.get_mako_template = get_mako_template diff --git a/account_financial_report_webkit/report/partners_ledger.py b/account_financial_report_webkit/report/partners_ledger.py index 55c22ce4..df66efac 100644 --- a/account_financial_report_webkit/report/partners_ledger.py +++ b/account_financial_report_webkit/report/partners_ledger.py @@ -146,12 +146,17 @@ class PartnersLedgerWebkit(report_sxw.rml_parse, ledger_lines = self._compute_partner_ledger_lines( accounts, main_filter, target_move, start, stop, partner_filter=partner_ids) - objects = [] - for account in self.pool.get('account.account').browse(self.cursor, - self.uid, - accounts): - account.ledger_lines = ledger_lines.get(account.id, {}) - account.init_balance = initial_balance_lines.get(account.id, {}) + objects = self.pool.get('account.account').browse(self.cursor, + self.uid, + accounts) + + init_balance = {} + ledger_lines_dict = {} + partners_order = {} + for account in objects: + ledger_lines_dict[account.id] = ledger_lines.get(account.id, {}) + init_balance[account.id] = initial_balance_lines.get(account.id, + {}) # we have to compute partner order based on inital balance # and ledger line as we may have partner with init bal # that are not in ledger line and vice versa @@ -159,17 +164,16 @@ class PartnersLedgerWebkit(report_sxw.rml_parse, if initial_balance_mode: non_null_init_balances = dict( [(ib, amounts) for ib, amounts - in account.init_balance.iteritems() + in init_balance[account.id].iteritems() if amounts['init_balance'] or amounts['init_balance_currency']]) init_bal_lines_pids = non_null_init_balances.keys() else: - account.init_balance = {} + init_balance[account.id] = {} init_bal_lines_pids = [] - account.partners_order = self._order_partners( + partners_order[account.id] = self._order_partners( ledg_lines_pids, init_bal_lines_pids) - objects.append(account) self.localcontext.update({ 'fiscalyear': fiscalyear, @@ -180,6 +184,9 @@ class PartnersLedgerWebkit(report_sxw.rml_parse, 'partner_ids': partner_ids, 'chart_account': chart_account, 'initial_balance_mode': initial_balance_mode, + 'init_balance': init_balance, + 'ledger_lines': ledger_lines_dict, + 'partners_order': partners_order }) return super(PartnersLedgerWebkit, self).set_context( diff --git a/account_financial_report_webkit/report/templates/account_report_general_ledger.mako b/account_financial_report_webkit/report/templates/account_report_general_ledger.mako index f99f7283..4a39e91a 100644 --- a/account_financial_report_webkit/report/templates/account_report_general_ledger.mako +++ b/account_financial_report_webkit/report/templates/account_report_general_ledger.mako @@ -75,8 +75,8 @@ %for account in objects: <% - display_initial_balance = account.init_balance and (account.init_balance.get('debit', 0.0) != 0.0 or account.init_balance.get('credit', 0.0) != 0.0) - display_ledger_lines = account.ledger_lines + display_initial_balance = init_balance[account.id] and (init_balance[account.id].get('debit') != 0.0 or init_balance[account.id].get('credit', 0.0) != 0.0) + display_ledger_lines = ledger_lines[account.id] %> %if display_account_raw(data) == 'all' or (display_ledger_lines or display_initial_balance): <% @@ -128,10 +128,10 @@
%if display_initial_balance: <% - cumul_debit = account.init_balance.get('debit') or 0.0 - cumul_credit = account.init_balance.get('credit') or 0.0 - cumul_balance = account.init_balance.get('init_balance') or 0.0 - cumul_balance_curr = account.init_balance.get('init_balance_currency') or 0.0 + cumul_debit = init_balance[account.id].get('debit') or 0.0 + cumul_credit = init_balance[account.id].get('credit') or 0.0 + cumul_balance = init_balance[account.id].get('init_balance') or 0.0 + cumul_balance_curr = init_balance[account.id].get('init_balance_currency') or 0.0 %>
## date @@ -153,9 +153,9 @@ ## counterpart
## debit -
${formatLang(account.init_balance.get('debit')) | amount}
+
${formatLang(init_balance[account.id].get('debit')) | amount}
## credit -
${formatLang(account.init_balance.get('credit')) | amount}
+
${formatLang(init_balance[account.id].get('credit')) | amount}
## balance cumulated
${formatLang(cumul_balance) | amount }
%if amount_currency(data): @@ -167,7 +167,7 @@
%endif - %for line in account.ledger_lines: + %for line in ledger_lines[account.id]: <% cumul_debit += line.get('debit') or 0.0 cumul_credit += line.get('credit') or 0.0 diff --git a/account_financial_report_webkit/report/templates/account_report_partner_balance.mako b/account_financial_report_webkit/report/templates/account_report_partner_balance.mako index 8e2cad7f..c05ae040 100644 --- a/account_financial_report_webkit/report/templates/account_report_partner_balance.mako +++ b/account_financial_report_webkit/report/templates/account_report_partner_balance.mako @@ -105,7 +105,7 @@ %for current_account in objects: <% - partners_order = current_account.partners_order + partners_order = partners_order[current_account.id] # do not display accounts without partners if not partners_order: diff --git a/account_financial_report_webkit/report/templates/account_report_partners_ledger.mako b/account_financial_report_webkit/report/templates/account_report_partners_ledger.mako index 122964a9..4c6b75e5 100644 --- a/account_financial_report_webkit/report/templates/account_report_partners_ledger.mako +++ b/account_financial_report_webkit/report/templates/account_report_partners_ledger.mako @@ -69,9 +69,9 @@
%for account in objects: - %if account.ledger_lines or account.init_balance: + %if ledger_lines[account.id] or init_balance[account.id]: <% - if not account.partners_order: + if not partners_order[account.id]: continue account_total_debit = 0.0 account_total_credit = 0.0 @@ -81,7 +81,7 @@
${account.code} - ${account.name}
- %for partner_name, p_id, p_ref, p_name in account.partners_order: + %for partner_name, p_id, p_ref, p_name in partners_order[account.id]: <% total_debit = 0.0 total_credit = 0.0 @@ -129,14 +129,14 @@
<% - total_debit = account.init_balance.get(p_id, {}).get('debit') or 0.0 - total_credit = account.init_balance.get(p_id, {}).get('credit') or 0.0 + total_debit = init_balance[account.id].get(p_id, {}).get('debit') or 0.0 + total_credit =init_balance[account.id].get(p_id, {}).get('credit') or 0.0 %> %if initial_balance_mode and (total_debit or total_credit): <% - part_cumul_balance = account.init_balance.get(p_id, {}).get('init_balance') or 0.0 - part_cumul_balance_curr = account.init_balance.get(p_id, {}).get('init_balance_currency') or 0.0 - balance_forward_currency = account.init_balance.get(p_id, {}).get('currency_name') or '' + part_cumul_balance = init_balance[account.id].get(p_id, {}).get('init_balance') or 0.0 + part_cumul_balance_curr = init_balance[account.id].get(p_id, {}).get('init_balance_currency') or 0.0 + balance_forward_currency = init_balance[account.id].get(p_id, {}).get('currency_name') or '' cumul_balance += part_cumul_balance cumul_balance_curr += part_cumul_balance_curr @@ -174,7 +174,7 @@
%endif - %for line in account.ledger_lines.get(p_id, []): + %for line in ledger_lines[account.id].get(p_id, []): <% total_debit += line.get('debit') or 0.0 total_credit += line.get('credit') or 0.0 diff --git a/account_financial_report_webkit/report/templates/aged_trial_webkit.mako b/account_financial_report_webkit/report/templates/aged_trial_webkit.mako index d021e252..ee62a4b9 100644 --- a/account_financial_report_webkit/report/templates/aged_trial_webkit.mako +++ b/account_financial_report_webkit/report/templates/aged_trial_webkit.mako @@ -110,7 +110,7 @@
- %for partner_name, p_id, p_ref, p_name in acc.partners_order: + %for partner_name, p_id, p_ref, p_name in partners_order[acc.id]: %if acc.aged_lines.get(p_id):
<%line = acc.aged_lines[p_id]%> diff --git a/account_financial_report_webkit/report/templates/grouped_by_curr_open_invoices_inclusion.mako.html b/account_financial_report_webkit/report/templates/grouped_by_curr_open_invoices_inclusion.mako.html index 91c49e47..e5c29aeb 100644 --- a/account_financial_report_webkit/report/templates/grouped_by_curr_open_invoices_inclusion.mako.html +++ b/account_financial_report_webkit/report/templates/grouped_by_curr_open_invoices_inclusion.mako.html @@ -1,13 +1,13 @@ ## -*- coding: utf-8 -*- <%page args="account, formatLang" /> -%if account.grouped_ledger_lines and account.partners_order: +%if account.grouped_ledger_lines and partners_order[account.id]: <% account_total_debit = 0.0 account_total_credit = 0.0 account_balance_cumul = 0.0 account_balance_cumul_curr = 0.0 %> - %for partner_name, p_id, p_ref, p_name in account.partners_order: + %for partner_name, p_id, p_ref, p_name in partners_order[account.id]: diff --git a/account_financial_report_webkit/report/templates/open_invoices_inclusion.mako.html b/account_financial_report_webkit/report/templates/open_invoices_inclusion.mako.html index e4969793..c61827bb 100644 --- a/account_financial_report_webkit/report/templates/open_invoices_inclusion.mako.html +++ b/account_financial_report_webkit/report/templates/open_invoices_inclusion.mako.html @@ -1,6 +1,6 @@ ## -*- coding: utf-8 -*- <%page args="account, formatLang" /> -%if account.ledger_lines and account.partners_order: +%if ledger_lines[account.id] and partners_order[account.id]: <% account_total_debit = 0.0 account_total_credit = 0.0 @@ -10,7 +10,7 @@ - %for partner_name, p_id, p_ref, p_name in account.partners_order: + %for partner_name, p_id, p_ref, p_name in partners_order[account.id]: <% total_debit = 0.0 total_credit = 0.0 @@ -67,7 +67,7 @@ def amount(text): return text.replace('-', '‑') # replace by a non-breaking hyphen (it will not word-wrap between hyphen and numbers) %> - %for line in account.ledger_lines.get(p_id, []): + %for line in ledger_lines[account.id].get(p_id, []): <% total_debit += line.get('debit') or 0.0 total_credit += line.get('credit') or 0.0 diff --git a/account_financial_report_webkit/report/webkit_parser_header_fix.py b/account_financial_report_webkit/report/webkit_parser_header_fix.py index c52b61af..a92c90fa 100644 --- a/account_financial_report_webkit/report/webkit_parser_header_fix.py +++ b/account_financial_report_webkit/report/webkit_parser_header_fix.py @@ -35,13 +35,13 @@ from functools import partial from mako import exceptions -from openerp.osv.osv import except_osv +from openerp.osv.orm import except_orm from openerp.tools.translate import _ -from openerp import addons from openerp import pooler from openerp import tools from openerp.addons.report_webkit import webkit_report from openerp.addons.report_webkit.report_helper import WebKitHelper +from openerp.modules.module import get_module_resource _logger = logging.getLogger('financial.reports.webkit') @@ -163,7 +163,7 @@ class HeaderFooterTextWebKitParser(webkit_report.WebKitParser): 'The following diagnosis message was provided:\n') + \ error_message if status: - raise except_osv(_('Webkit error'), + raise except_orm(_('Webkit error'), _("The command 'wkhtmltopdf' failed with \ error code = %s. Message: %s") % (status, error_message)) @@ -205,19 +205,19 @@ class HeaderFooterTextWebKitParser(webkit_report.WebKitParser): template = False if report_xml.report_file: - path = addons.get_module_resource( + path = get_module_resource( *report_xml.report_file.split(os.path.sep)) if os.path.exists(path): template = file(path).read() if not template and report_xml.report_webkit_data: template = report_xml.report_webkit_data if not template: - raise except_osv( + raise except_orm( _('Error!'), _('Webkit Report template not found !')) header = report_xml.webkit_header.html if not header and report_xml.header: - raise except_osv( + raise except_orm( _('No header defined for this Webkit report!'), _('Please set a header in company settings.') ) @@ -243,7 +243,7 @@ class HeaderFooterTextWebKitParser(webkit_report.WebKitParser): except Exception: msg = exceptions.text_error_template().render() _logger.error(msg) - raise except_osv(_('Webkit render'), msg) + raise except_orm(_('Webkit render'), msg) else: try: html = body_mako_tpl.render(helper=helper, @@ -254,7 +254,7 @@ class HeaderFooterTextWebKitParser(webkit_report.WebKitParser): except Exception: msg = exceptions.text_error_template().render() _logger.error(msg) - raise except_osv(_('Webkit render'), msg) + raise except_orm(_('Webkit render'), msg) # NO html footer and header because we write them as text with # wkhtmltopdf @@ -270,7 +270,7 @@ class HeaderFooterTextWebKitParser(webkit_report.WebKitParser): except Exception: msg = exceptions.text_error_template().render() _logger.error(msg) - raise except_osv(_('Webkit render'), msg) + raise except_orm(_('Webkit render'), msg) return (deb, 'html') bin = self.get_lib(cursor, uid) pdf = self.generate_pdf(bin, report_xml, head, foot, htmls, diff --git a/account_financial_report_webkit/tests/aged_trial_balance.yml b/account_financial_report_webkit/tests/aged_trial_balance.yml index fa311429..d94cddab 100644 --- a/account_financial_report_webkit/tests/aged_trial_balance.yml +++ b/account_financial_report_webkit/tests/aged_trial_balance.yml @@ -5,7 +5,7 @@ from datetime import datetime ctx={} data_dict = {'chart_account_id':ref('account.chart0'), 'until_date': '%s-12-31' %(datetime.now().year)} - from tools import test_reports + from openerp.tools import test_reports test_reports.try_report_action(cr, uid, 'action_account_aged_trial_balance_menu_webkit',wiz_data=data_dict, context=ctx, our_module='account_financial_report_webkit') - @@ -17,7 +17,7 @@ data_dict = {'chart_account_id':ref('account.chart0'), 'fiscalyear_id': ref('account.data_fiscalyear'), 'until_date': '%s-12-31' %(datetime.now().year), 'target_move': 'posted', 'amount_currency': True, 'result_selection': 'customer_supplier'} - from tools import test_reports + from openerp.tools import test_reports test_reports.try_report_action(cr, uid, 'action_account_aged_trial_balance_menu_webkit',wiz_data=data_dict, context=ctx, our_module='account_financial_report_webkit') - @@ -30,7 +30,7 @@ 'until_date': '%s-12-31' %(datetime.now().year), 'target_move': 'posted', 'amount_currency': True, 'result_selection': 'customer_supplier', 'partner_ids': [ref('base.res_partner_2'), ref('base.res_partner_1')]} - from tools import test_reports + from openerp.tools import test_reports test_reports.try_report_action(cr, uid, 'action_account_aged_trial_balance_menu_webkit',wiz_data=data_dict, context=ctx, our_module='account_financial_report_webkit') - @@ -43,7 +43,7 @@ 'until_date': '%s-12-31' %(datetime.now().year), 'target_move': 'posted', 'amount_currency': True, 'result_selection': 'customer_supplier', 'filter': 'filter_period', 'period_from': ref('account.period_1'), 'period_to': ref('account.period_12')} - from tools import test_reports + from openerp.tools import test_reports test_reports.try_report_action(cr, uid, 'action_account_aged_trial_balance_menu_webkit',wiz_data=data_dict, context=ctx, our_module='account_financial_report_webkit') - @@ -56,5 +56,5 @@ 'until_date': '%s-12-31' %(datetime.now().year), 'target_move': 'posted', 'amount_currency': True, 'result_selection': 'customer_supplier', 'filter': 'filter_date', 'date_from': '%s-01-01' %(datetime.now().year), 'date_to': '%s-12-31' %(datetime.now().year)} - from tools import test_reports + from openerp.tools import test_reports test_reports.try_report_action(cr, uid, 'action_account_aged_trial_balance_menu_webkit',wiz_data=data_dict, context=ctx, our_module='account_financial_report_webkit') diff --git a/account_financial_report_webkit/tests/general_ledger.yml b/account_financial_report_webkit/tests/general_ledger.yml index 17f733d8..2f5143a7 100644 --- a/account_financial_report_webkit/tests/general_ledger.yml +++ b/account_financial_report_webkit/tests/general_ledger.yml @@ -5,7 +5,7 @@ ctx={} data_dict = {'chart_account_id':ref('account.chart0')} ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')],'active_id':ref('account.chart0')}) - from tools import test_reports + from openerp.tools import test_reports test_reports.try_report_action(cr, uid, 'action_account_general_ledger_menu_webkit',wiz_data=data_dict, context=ctx, our_module='account_financial_report_webkit') - @@ -15,7 +15,7 @@ ctx={} data_dict = {'chart_account_id':ref('account.chart0'), 'target_move': 'posted'} ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')],'active_id':ref('account.chart0')}) - from tools import test_reports + from openerp.tools import test_reports test_reports.try_report_action(cr, uid, 'action_account_general_ledger_menu_webkit',wiz_data=data_dict, context=ctx, our_module='account_financial_report_webkit') - @@ -25,7 +25,7 @@ ctx={} data_dict = {'chart_account_id':ref('account.chart0'), 'display_account': 'bal_mix'} ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')],'active_id':ref('account.chart0')}) - from tools import test_reports + from openerp.tools import test_reports test_reports.try_report_action(cr, uid, 'action_account_general_ledger_menu_webkit',wiz_data=data_dict, context=ctx, our_module='account_financial_report_webkit') - @@ -35,7 +35,7 @@ ctx={} data_dict = {'chart_account_id':ref('account.chart0'), 'amount_currency': 1} ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')],'active_id':ref('account.chart0')}) - from tools import test_reports + from openerp.tools import test_reports test_reports.try_report_action(cr, uid, 'action_account_general_ledger_menu_webkit',wiz_data=data_dict, context=ctx, our_module='account_financial_report_webkit') #Filter by date @@ -48,7 +48,7 @@ data_dict = {'chart_account_id':ref('account.chart0'),'amount_currency': 1, 'chart_account_id': 1, 'date_from': '%s-01-01' %(datetime.now().year), 'date_to':'%s-04-01' %(datetime.now().year), 'display_account': 'bal_all', 'filter': 'filter_date',} ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')],'active_id':ref('account.chart0')}) - from tools import test_reports + from openerp.tools import test_reports test_reports.try_report_action(cr, uid, 'action_account_general_ledger_menu_webkit',wiz_data=data_dict, context=ctx, our_module='account_financial_report_webkit') - @@ -60,6 +60,6 @@ data_dict = {'chart_account_id':ref('account.chart0'),'amount_currency': 1, 'chart_account_id': 1, 'date_from': '%s-01-01' %(datetime.now().year), 'date_to':'%s-04-01' %(datetime.now().year), 'display_account': 'bal_all', 'filter': 'filter_date',} ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')],'active_id':ref('account.chart0')}) - from tools import test_reports + from openerp.tools import test_reports test_reports.try_report_action(cr, uid, 'action_account_general_ledger_menu_webkit',wiz_data=data_dict, context=ctx, our_module='account_financial_report_webkit') # I still have to parse report content but for this I need accounting data on multiple exercises and faor all fiscal year diff --git a/account_financial_report_webkit/tests/open_invoices.yml b/account_financial_report_webkit/tests/open_invoices.yml index a0d90b04..17b5942d 100644 --- a/account_financial_report_webkit/tests/open_invoices.yml +++ b/account_financial_report_webkit/tests/open_invoices.yml @@ -5,7 +5,7 @@ from datetime import datetime ctx={} data_dict = {'chart_account_id':ref('account.chart0'), 'until_date': '%s-12-31' %(datetime.now().year)} - from tools import test_reports + from openerp.tools import test_reports test_reports.try_report_action(cr, uid, 'action_account_open_invoices_menu_webkit',wiz_data=data_dict, context=ctx, our_module='account_financial_report_webkit') - @@ -17,7 +17,7 @@ data_dict = {'chart_account_id':ref('account.chart0'), 'fiscalyear_id': ref('account.data_fiscalyear'), 'until_date': '%s-12-31' %(datetime.now().year), 'target_move': 'posted', 'amount_currency': True, 'result_selection': 'customer_supplier'} - from tools import test_reports + from openerp.tools import test_reports test_reports.try_report_action(cr, uid, 'action_account_open_invoices_menu_webkit',wiz_data=data_dict, context=ctx, our_module='account_financial_report_webkit') - @@ -30,7 +30,7 @@ 'until_date': '%s-12-31' %(datetime.now().year), 'target_move': 'posted', 'amount_currency': True, 'result_selection': 'customer_supplier', 'partner_ids': [ref('base.res_partner_2'), ref('base.res_partner_1')]} - from tools import test_reports + from openerp.tools import test_reports test_reports.try_report_action(cr, uid, 'action_account_open_invoices_menu_webkit',wiz_data=data_dict, context=ctx, our_module='account_financial_report_webkit') - @@ -43,7 +43,7 @@ 'until_date': '%s-12-31' %(datetime.now().year), 'target_move': 'posted', 'amount_currency': True, 'result_selection': 'customer_supplier', 'filter': 'filter_period', 'period_from': ref('account.period_1'), 'period_to': ref('account.period_12')} - from tools import test_reports + from openerp.tools import test_reports test_reports.try_report_action(cr, uid, 'action_account_open_invoices_menu_webkit',wiz_data=data_dict, context=ctx, our_module='account_financial_report_webkit') - @@ -56,5 +56,5 @@ 'until_date': '%s-12-31' %(datetime.now().year), 'target_move': 'posted', 'amount_currency': True, 'result_selection': 'customer_supplier', 'filter': 'filter_date', 'date_from': '%s-01-01' %(datetime.now().year), 'date_to': '%s-12-31' %(datetime.now().year)} - from tools import test_reports + from openerp.tools import test_reports test_reports.try_report_action(cr, uid, 'action_account_open_invoices_menu_webkit',wiz_data=data_dict, context=ctx, our_module='account_financial_report_webkit') diff --git a/account_financial_report_webkit/tests/partner_balance.yml b/account_financial_report_webkit/tests/partner_balance.yml index 37613104..b67c3060 100644 --- a/account_financial_report_webkit/tests/partner_balance.yml +++ b/account_financial_report_webkit/tests/partner_balance.yml @@ -5,7 +5,7 @@ from datetime import datetime ctx={} data_dict = {'chart_account_id':ref('account.chart0')} - from tools import test_reports + from openerp.tools import test_reports test_reports.try_report_action(cr, uid, 'action_account_partner_balance_menu_webkit',wiz_data=data_dict, context=ctx, our_module='account_financial_report_webkit') - @@ -16,7 +16,7 @@ ctx={} data_dict = {'chart_account_id':ref('account.chart0')} ctx.update({'model': 'account.account','active_ids':[ref('account.assets_view'), ref('account.liabilities_view')],'active_id': ref('account.assets_view')}) - from tools import test_reports + from openerp.tools import test_reports test_reports.try_report_action(cr, uid, 'action_account_partner_balance_menu_webkit',wiz_data=data_dict, context=ctx, our_module='account_financial_report_webkit') - @@ -27,7 +27,7 @@ ctx={} data_dict = {'chart_account_id':ref('account.chart0'), 'fiscalyear_id': ref('account.data_fiscalyear'), 'filter': 'filter_period', 'period_from': ref('account.period_1'), 'period_to': ref('account.period_12')} - from tools import test_reports + from openerp.tools import test_reports test_reports.try_report_action(cr, uid, 'action_account_partner_balance_menu_webkit',wiz_data=data_dict, context=ctx, our_module='account_financial_report_webkit') - @@ -38,7 +38,7 @@ ctx={} data_dict = {'chart_account_id':ref('account.chart0'), 'fiscalyear_id': ref('account.data_fiscalyear'), 'filter': 'filter_date', 'date_from': '%s-01-01' %(datetime.now().year), 'date_to': '%s-12-31' %(datetime.now().year)} - from tools import test_reports + from openerp.tools import test_reports test_reports.try_report_action(cr, uid, 'action_account_partner_balance_menu_webkit',wiz_data=data_dict, context=ctx, our_module='account_financial_report_webkit') - @@ -49,7 +49,7 @@ ctx={} data_dict = {'chart_account_id':ref('account.chart0'), 'fiscalyear_id': ref('account.data_fiscalyear'), 'comp0_filter': 'filter_year', 'comp0_fiscalyear_id': ref('account.data_fiscalyear')} - from tools import test_reports + from openerp.tools import test_reports test_reports.try_report_action(cr, uid, 'action_account_partner_balance_menu_webkit',wiz_data=data_dict, context=ctx, our_module='account_financial_report_webkit') - @@ -63,5 +63,5 @@ 'comp1_filter': 'filter_period', 'comp1_period_from': ref('account.period_1'), 'comp1_period_to': ref('account.period_12'), 'comp2_filter': 'filter_date', 'comp2_date_from': '%s-01-01' %(datetime.now().year), 'comp2_date_to': '%s-12-31' %(datetime.now().year) } - from tools import test_reports + from openerp.tools import test_reports test_reports.try_report_action(cr, uid, 'action_account_partner_balance_menu_webkit',wiz_data=data_dict, context=ctx, our_module='account_financial_report_webkit') diff --git a/account_financial_report_webkit/tests/partner_ledger.yml b/account_financial_report_webkit/tests/partner_ledger.yml index dc2302f0..459bc7bf 100644 --- a/account_financial_report_webkit/tests/partner_ledger.yml +++ b/account_financial_report_webkit/tests/partner_ledger.yml @@ -5,7 +5,7 @@ from datetime import datetime ctx={} data_dict = {'chart_account_id':ref('account.chart0'), 'until_date': '%s-12-31' %(datetime.now().year)} - from tools import test_reports + from openerp.tools import test_reports test_reports.try_report_action(cr, uid, 'action_account_partners_ledger_menu_webkit',wiz_data=data_dict, context=ctx, our_module='account_financial_report_webkit') - @@ -17,7 +17,7 @@ data_dict = {'chart_account_id':ref('account.chart0'), 'fiscalyear_id': ref('account.data_fiscalyear'), 'until_date': '%s-12-31' %(datetime.now().year), 'target_move': 'posted', 'amount_currency': True, 'result_selection': 'customer_supplier'} - from tools import test_reports + from openerp.tools import test_reports test_reports.try_report_action(cr, uid, 'action_account_partners_ledger_menu_webkit',wiz_data=data_dict, context=ctx, our_module='account_financial_report_webkit') - @@ -30,7 +30,7 @@ 'until_date': '%s-12-31' %(datetime.now().year), 'target_move': 'posted', 'amount_currency': True, 'result_selection': 'customer_supplier', 'partner_ids': [ref('base.res_partner_2'), ref('base.res_partner_1')]} - from tools import test_reports + from openerp.tools import test_reports test_reports.try_report_action(cr, uid, 'action_account_partners_ledger_menu_webkit',wiz_data=data_dict, context=ctx, our_module='account_financial_report_webkit') - @@ -43,7 +43,7 @@ 'until_date': '%s-12-31' %(datetime.now().year), 'target_move': 'posted', 'amount_currency': True, 'result_selection': 'customer_supplier', 'filter': 'filter_period', 'period_from': ref('account.period_1'), 'period_to': ref('account.period_12')} - from tools import test_reports + from openerp.tools import test_reports test_reports.try_report_action(cr, uid, 'action_account_partners_ledger_menu_webkit',wiz_data=data_dict, context=ctx, our_module='account_financial_report_webkit') - @@ -56,5 +56,5 @@ 'until_date': '%s-12-31' %(datetime.now().year), 'target_move': 'posted', 'amount_currency': True, 'result_selection': 'customer_supplier', 'filter': 'filter_date', 'date_from': '%s-01-01' %(datetime.now().year), 'date_to': '%s-12-31' %(datetime.now().year)} - from tools import test_reports + from openerp.tools import test_reports test_reports.try_report_action(cr, uid, 'action_account_partners_ledger_menu_webkit',wiz_data=data_dict, context=ctx, our_module='account_financial_report_webkit') diff --git a/account_financial_report_webkit/tests/trial_balance.yml b/account_financial_report_webkit/tests/trial_balance.yml index f5d276c3..974dc3ca 100644 --- a/account_financial_report_webkit/tests/trial_balance.yml +++ b/account_financial_report_webkit/tests/trial_balance.yml @@ -5,7 +5,7 @@ from datetime import datetime ctx={} data_dict = {'chart_account_id':ref('account.chart0')} - from tools import test_reports + from openerp.tools import test_reports test_reports.try_report_action(cr, uid, 'action_account_trial_balance_menu_webkit',wiz_data=data_dict, context=ctx, our_module='account_financial_report_webkit') - @@ -16,7 +16,7 @@ ctx={} data_dict = {'chart_account_id':ref('account.chart0')} ctx.update({'model': 'account.account','active_ids':[ref('account.assets_view'), ref('account.liabilities_view')],'active_id': ref('account.assets_view')}) - from tools import test_reports + from openerp.tools import test_reports test_reports.try_report_action(cr, uid, 'action_account_trial_balance_menu_webkit',wiz_data=data_dict, context=ctx, our_module='account_financial_report_webkit') - @@ -27,7 +27,7 @@ ctx={} data_dict = {'chart_account_id':ref('account.chart0'), 'fiscalyear_id': ref('account.data_fiscalyear'), 'filter': 'filter_period', 'period_from': ref('account.period_1'), 'period_to': ref('account.period_12')} - from tools import test_reports + from openerp.tools import test_reports test_reports.try_report_action(cr, uid, 'action_account_trial_balance_menu_webkit',wiz_data=data_dict, context=ctx, our_module='account_financial_report_webkit') - @@ -38,7 +38,7 @@ ctx={} data_dict = {'chart_account_id':ref('account.chart0'), 'fiscalyear_id': ref('account.data_fiscalyear'), 'filter': 'filter_date', 'date_from': '%s-01-01' %(datetime.now().year), 'date_to': '%s-12-31' %(datetime.now().year)} - from tools import test_reports + from openerp.tools import test_reports test_reports.try_report_action(cr, uid, 'action_account_trial_balance_menu_webkit',wiz_data=data_dict, context=ctx, our_module='account_financial_report_webkit') - @@ -49,7 +49,7 @@ ctx={} data_dict = {'chart_account_id':ref('account.chart0'), 'fiscalyear_id': ref('account.data_fiscalyear'), 'comp0_filter': 'filter_year', 'comp0_fiscalyear_id': ref('account.data_fiscalyear')} - from tools import test_reports + from openerp.tools import test_reports test_reports.try_report_action(cr, uid, 'action_account_trial_balance_menu_webkit',wiz_data=data_dict, context=ctx, our_module='account_financial_report_webkit') - @@ -63,5 +63,5 @@ 'comp1_filter': 'filter_period', 'comp1_period_from': ref('account.period_1'), 'comp1_period_to': ref('account.period_12'), 'comp2_filter': 'filter_date', 'comp2_date_from': '%s-01-01' %(datetime.now().year), 'comp2_date_to': '%s-12-31' %(datetime.now().year) } - from tools import test_reports + from openerp.tools import test_reports test_reports.try_report_action(cr, uid, 'action_account_trial_balance_menu_webkit',wiz_data=data_dict, context=ctx, our_module='account_financial_report_webkit')