Added wizard for printing indicators and minor modifications.

bzr revid: jvo@tinyerp.com-20081010115817-i1lf5k3rqonmicxz
This commit is contained in:
Jay Vora 2008-10-10 17:28:17 +05:30
parent 89b9a827d0
commit 8ebb7ae477
7 changed files with 129 additions and 0 deletions

View File

@ -30,6 +30,7 @@
import account
import report
import wizard
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -40,6 +40,7 @@
"security/ir.model.access.csv",
"account_view.xml",
"account_report.xml",
"account_wizard.xml",
],
# "translations" : {
# "fr": "i18n/french_fr.csv"

View File

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

View File

@ -2,5 +2,8 @@
<openerp>
<data>
<report auto="False" id="fiscal_statements" model="account.report.report" name="accounting.report" rml="account_report/report/accounting_report.rml" string="Fiscal Statements"/>
<report auto="False" id="report_print_indicators" model="account.report.report" name="report.print.indicators" rml="account_report/report/report_print_indicators.rml" string="Indicators"/>
</data>
</openerp>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<wizard id="wizard_print_indicators" name="print.indicators" string="Print Indicators"/>
<menuitem action="wizard_print_indicators" type="wizard" parent="account_report.menu_action_account_report_tree_view" id="menu_wizard_print_indicators"/>
</data>
</openerp>

View File

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

View File

@ -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 = '''<?xml version="1.0"?>
<form string="Print Indicators">
<field name="indicator_id"/>
<field name="select_base"/>
</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 = '''<?xml version="1.0"?>
<form string="Print Indicators">
<field name="base_selection"/>
</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: