From ce63f710195ee0b4b685b727dfbc33453846bff8 Mon Sep 17 00:00:00 2001 From: "psi (Open ERP)" Date: Wed, 28 Apr 2010 10:43:12 +0530 Subject: [PATCH] [ADD] account/project/wizard : convert account_analytic_invert_balance_report to osv_memory bzr revid: psi@tinyerp.co.in-20100428051312-q0wkepu5o4xyy4k2 --- addons/account/__openerp__.py | 3 +- addons/account/project/project_report.xml | 2 +- addons/account/project/wizard/__init__.py | 5 +- ...count_analytic_inverted_balance_report.py} | 56 ++++++++++--------- ...count_analytic_inverted_balance_report.xml | 45 +++++++++++++++ 5 files changed, 80 insertions(+), 31 deletions(-) rename addons/account/project/wizard/{wizard_account_analytic_inverted_balance_report.py => account_analytic_inverted_balance_report.py} (51%) create mode 100644 addons/account/project/wizard/account_analytic_inverted_balance_report.xml diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py index fb4ad1f3d3b..cd8a673741a 100644 --- a/addons/account/__openerp__.py +++ b/addons/account/__openerp__.py @@ -94,6 +94,7 @@ module named account_voucherss 'project/wizard/account_analytic_check_view.xml', 'project/wizard/account_analytic_balance_report_view.xml', 'project/wizard/account_analytic_cost_ledger_view.xml', + 'project/wizard/account_analytic_inverted_balance_report.xml', 'product_view.xml', 'account_assert_test.xml', 'process/statement_process.xml', @@ -118,4 +119,4 @@ module named account_voucherss 'active': False, 'certificate': '0080331923549', } -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/account/project/project_report.xml b/addons/account/project/project_report.xml index 71353ba282f..ff2cef7693c 100644 --- a/addons/account/project/project_report.xml +++ b/addons/account/project/project_report.xml @@ -13,7 +13,7 @@ - + diff --git a/addons/account/project/wizard/__init__.py b/addons/account/project/wizard/__init__.py index 242350daf14..4788302fd63 100644 --- a/addons/account/project/wizard/__init__.py +++ b/addons/account/project/wizard/__init__.py @@ -21,12 +21,11 @@ import wizard_account_analytic_journal_report import account_analytic_balance_report -import wizard_account_analytic_inverted_balance_report +import account_analytic_inverted_balance_report import account_analytic_cost_ledger_report import wizard_account_analytic_cost_ledger_for_journal_report import account_analytic_check import project_account_analytic_line import wizard_analytic_account_chart -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/account/project/wizard/wizard_account_analytic_inverted_balance_report.py b/addons/account/project/wizard/account_analytic_inverted_balance_report.py similarity index 51% rename from addons/account/project/wizard/wizard_account_analytic_inverted_balance_report.py rename to addons/account/project/wizard/account_analytic_inverted_balance_report.py index 9219a8ea9ae..52f7da936fe 100644 --- a/addons/account/project/wizard/wizard_account_analytic_inverted_balance_report.py +++ b/addons/account/project/wizard/account_analytic_inverted_balance_report.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (). # @@ -15,38 +15,42 @@ # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . +# along with this program. If not, see . # ############################################################################## - import time -import wizard -dates_form = ''' -
- - -''' +from osv import osv, fields -dates_fields = { - 'date1': {'string':'Start of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-01-01')}, - 'date2': {'string':'End of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')}, -} +class account_analytic_inverted_balance(osv.osv_memory): + _name = 'account.analytic.inverted.balance' + _description = 'Account Analytic Inverted Balance' -class wizard_report(wizard.interface): - states = { - 'init': { - 'actions': [], - 'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[('end','Cancel'), ('report','Print')]} - }, - 'report': { - 'actions': [], - 'result': {'type':'print', 'report':'account.analytic.account.inverted.balance', 'state':'end'} + _columns = { + 'date1': fields.date('Start of period', required=True), + 'date2': fields.date('End of period', required=True), } - } -wizard_report('account.analytic.account.inverted.balance.report') + _defaults = { + 'date1':time.strftime('%Y-01-01'), + 'date2':time.strftime('%Y-%m-%d') + } + def check_report(self, cr, uid, ids, context=None): + datas = {} + if context is None: + context = {} + data = self.read(cr, uid, ids)[0] + datas = { + 'ids': context.get('active_ids',[]), + 'model': 'account.analytic.account', + 'form': data + } + return { + 'type': 'ir.actions.report.xml', + 'report_name': 'account.analytic.account.inverted.balance', + 'datas': datas, + } -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - +account_analytic_inverted_balance() +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/account/project/wizard/account_analytic_inverted_balance_report.xml b/addons/account/project/wizard/account_analytic_inverted_balance_report.xml new file mode 100644 index 00000000000..e989f766d7b --- /dev/null +++ b/addons/account/project/wizard/account_analytic_inverted_balance_report.xml @@ -0,0 +1,45 @@ + + + + + + Account Analytic Inverted Balance + account.analytic.inverted.balance + form + +
+ + + + + + +