From 8ebb7ae4770835aea03c5a014dba84ca8235bd49 Mon Sep 17 00:00:00 2001 From: Jay Vora Date: Fri, 10 Oct 2008 17:28:17 +0530 Subject: [PATCH] Added wizard for printing indicators and minor modifications. bzr revid: jvo@tinyerp.com-20081010115817-i1lf5k3rqonmicxz --- addons/account_report/__init__.py | 1 + addons/account_report/__terp__.py | 1 + addons/account_report/account.py | 3 + addons/account_report/account_report.xml | 3 + addons/account_report/account_wizard.xml | 7 ++ addons/account_report/wizard/__init__.py | 33 ++++++++ .../wizard/wizard_print_indicators.py | 81 +++++++++++++++++++ 7 files changed, 129 insertions(+) create mode 100644 addons/account_report/account_wizard.xml create mode 100644 addons/account_report/wizard/__init__.py create mode 100644 addons/account_report/wizard/wizard_print_indicators.py diff --git a/addons/account_report/__init__.py b/addons/account_report/__init__.py index e4816074891..a06b62c4ee7 100644 --- a/addons/account_report/__init__.py +++ b/addons/account_report/__init__.py @@ -30,6 +30,7 @@ import account import report +import wizard # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_report/__terp__.py b/addons/account_report/__terp__.py index 852bc422fef..2bcbde6bab7 100644 --- a/addons/account_report/__terp__.py +++ b/addons/account_report/__terp__.py @@ -40,6 +40,7 @@ "security/ir.model.access.csv", "account_view.xml", "account_report.xml", + "account_wizard.xml", ], # "translations" : { # "fr": "i18n/french_fr.csv" diff --git a/addons/account_report/account.py b/addons/account_report/account.py index 29bc590556a..25c1ed56e39 100644 --- a/addons/account_report/account.py +++ b/addons/account_report/account.py @@ -210,6 +210,9 @@ class account_report_history(osv.osv): def init(self, cr): cr.execute('''create or replace view account_report as (select ar.id as tmp,((pr.id*100000)+ar.id) as id,ar.id as name,pr.id as period_id,pr.fiscalyear_id as fiscalyear_id from account_report_report as ar cross join account_period as pr group by ar.id,pr.id,pr.fiscalyear_id)''') + def unlink(self, cr, uid, ids, context={}): + raise osv.except_osv(_('Error !'), _('You can not delete an indicator history record. You may have to delete the concerned Indicator!')) + account_report_history() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_report/account_report.xml b/addons/account_report/account_report.xml index 50464753f8b..082c15f139f 100755 --- a/addons/account_report/account_report.xml +++ b/addons/account_report/account_report.xml @@ -2,5 +2,8 @@ + + + diff --git a/addons/account_report/account_wizard.xml b/addons/account_report/account_wizard.xml new file mode 100644 index 00000000000..63d4303f0c5 --- /dev/null +++ b/addons/account_report/account_wizard.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/addons/account_report/wizard/__init__.py b/addons/account_report/wizard/__init__.py new file mode 100644 index 00000000000..5194e21e5d3 --- /dev/null +++ b/addons/account_report/wizard/__init__.py @@ -0,0 +1,33 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved. +# +# $Id$ +# +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsability of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# garantees and support are strongly adviced to contract a Free Software +# Service Company +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################## + +import wizard_print_indicators + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_report/wizard/wizard_print_indicators.py b/addons/account_report/wizard/wizard_print_indicators.py new file mode 100644 index 00000000000..373b86fd914 --- /dev/null +++ b/addons/account_report/wizard/wizard_print_indicators.py @@ -0,0 +1,81 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved. +# +# $Id$ +# +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsability of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# garantees and support are strongly adviced to contract a Free Software +# Service Company +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################## + +import wizard +import pooler + +form = ''' +
+ + +''' + +fields = { + 'indicator_id': {'string':'Choose Indicator', 'type':'many2one', 'relation': 'account.report.report','required':True,}, + 'select_base': {'string':'Choose Criteria', 'type':'selection','selection':[('year','Based On Fiscal Years'),('periods','Based on Fiscal Periods')],'required':True,}, +} + +next_form = ''' +
+ +''' + +next_fields = { + 'base_selection': {'string':'Select Criteria', 'type':'many2many','required':True,}, +} + +def _load(self, cr, uid, data, context): + data['form']['select_base'] = 'year' + return data['form'] + +def _load_base(self, cr, uid, data, context): + next_fields['base_selection']['relation']='account.fiscalyear' + if data['form']['select_base']=='periods': + next_fields['base_selection']['relation']='account.period' + return data['form'] + +class wizard_print_indicators(wizard.interface): + states = { + 'init': { + 'actions': [_load], + 'result': {'type': 'form', 'arch':form, 'fields':fields, 'state':[('end','Cancel'),('next','Next')]} + }, + 'next': { + 'actions': [_load_base], + 'result': {'type':'form', 'arch':next_form, 'fields':next_fields, 'state':[('end','Cancel'),('print','Print')]} + }, + 'print': { + 'actions':[], + 'result' :{'type':'print','report':'report.print.indicators', 'state':'end'} + } + } +wizard_print_indicators('print.indicators') + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: