[ADD, MOD] account_budget : all wizards are converted to osv memory wizard

bzr revid: vir@tinyerp.com-20100428123143-gu6iqb3lsfljzrzm
This commit is contained in:
Vir (Open ERP) 2010-04-28 18:01:43 +05:30
parent a072f5c462
commit 6ae7b8b26a
17 changed files with 446 additions and 235 deletions

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
@ -15,7 +15,7 @@
# 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 <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
@ -51,9 +51,15 @@ Three reports are available:
'security/ir.model.access.csv',
'security/account_budget_security.xml',
'account_budget_wizard.xml',
'wizard/account_budget_spread_view.xml',
'crossovered_budget_view.xml',
'crossovered_budget_report.xml',
'crossovered_budget_workflow.xml'
'crossovered_budget_workflow.xml',
'wizard/account_budget_analytic_view.xml',
'wizard/account_budget_report_view.xml',
'wizard/account_budget_spread_view.xml',
'wizard/account_budget_crossovered_summary_report_view.xml',
'wizard/account_budget_crossovered_report_view.xml',
],
'demo_xml': ['crossovered_budget_demo.xml'],
'installable': True,

View File

@ -1,9 +1,9 @@
<?xml version="1.0"?>
<openerp>
<data>
<wizard id="wizard_budget_spread" menu="False" model="account.budget.post" name="account.budget.spread" string="Spread amount"/>
<!-- <wizard id="wizard_budget_spread" menu="False" model="account.budget.post" name="account.budget.spread" string="Spread amount"/>-->
<wizard id="wizard_budget_report" keyword="client_print_multi" model="account.budget.post" name="account.budget.report" string="Budget"/>
<!-- <wizard id="wizard_budget_report" keyword="client_print_multi" model="account.budget.post" name="account.budget.report" string="Budget"/>-->
</data>
</openerp>

View File

@ -11,35 +11,35 @@
auto="False"
menu="False" />
<wizard
string="Print Budgets"
model="crossovered.budget"
name="wizard.crossovered.budget"
id="wizard_crossovered_budget_menu"
keyword="client_print_multi" />
<!-- <wizard-->
<!-- string="Print Budgets"-->
<!-- model="crossovered.budget"-->
<!-- name="wizard.crossovered.budget"-->
<!-- id="wizard_crossovered_budget_menu"-->
<!-- keyword="client_print_multi" />-->
<wizard
string="Print Summary of Budgets"
model="crossovered.budget"
name="wizard.crossovered.budget.summary"
id="wizard_crossovered_budget_menu_1"
keyword="client_print_multi" />
<!-- <wizard-->
<!-- string="Print Summary of Budgets"-->
<!-- model="crossovered.budget"-->
<!-- name="wizard.crossovered.budget.summary"-->
<!-- id="wizard_crossovered_budget_menu_1"-->
<!-- keyword="client_print_multi" />-->
<!-- Reports on account.analytic.account -->
<wizard
id="account_analytic_account_budget_report"
string="Print Budgets"
model="account.analytic.account"
name="wizard.analytic.account.budget.report"
keyword="client_print_multi"/>
<report id="account_analytic_account_budget"
string="Print Budgets"
model="account.analytic.account"
name="account.analytic.account.budget"
rml="account_budget/report/analytic_account_budget_report.rml"
auto="False"
menu="False"/>
<!-- <wizard-->
<!-- id="account_analytic_account_budget_report"-->
<!-- string="Print Budgets"-->
<!-- model="account.analytic.account"-->
<!-- name="wizard.analytic.account.budget.report"-->
<!-- keyword="client_print_multi"/>-->
<!---->
<!-- <report id="account_analytic_account_budget"-->
<!-- string="Print Budgets"-->
<!-- model="account.analytic.account"-->
<!-- name="account.analytic.account.budget"-->
<!-- rml="account_budget/report/analytic_account_budget_report.rml"-->
<!-- auto="False"-->
<!-- menu="False"/>-->
<!-- moved from account module -->
<report auto="False"

View File

@ -76,7 +76,7 @@
<field name="account_ids" colspan="4" nolabel="1"/>
</page>
<page string="Dotations">
<button string="Spread" name="%(wizard_budget_spread)d" type="action" icon="gtk-fullscreen"/>
<button string="Spread" name="%(action_account_budget_spread)d" type="action" icon="gtk-fullscreen"/>
<field name="dotation_ids" colspan="4" nolabel="1"/>
</page>

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
@ -15,15 +15,15 @@
# 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 <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import wizard_crossovered_budget_report
import wizard_analytic_account_budget
import wizard_crossovered_budget_summary_report
import account_budget_crossovered_report
import account_budget_analytic
import account_budget_crossovered_summary_report
import wizard_budget_spread
import wizard_budget_report
import account_budget_spread
import account_budget_report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -18,33 +18,40 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import time
import wizard
dates_form = '''<?xml version="1.0"?>
<form string="Select Dates Period">
<field name="date_from"/>
<field name="date_to"/>
</form>'''
from osv import fields, osv
dates_fields = {
'date_from': {'string':'Start of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-01-01')},
'date_to': {'string':'End of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')}
}
class account_budget_analytic(osv.osv_memory):
class wizard_report(wizard.interface):
states = {
'init': {
'actions': [],
'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[('end','Cancel', 'gtk-cancel'),('report','Print', 'gtk-print', True)]}
},
'report': {
'actions': [],
'result': {'type':'print', 'report':'account.analytic.account.budget', 'state':'end'}
_name = 'account.budget.analytic'
_description = 'Account Budget report for analytic account'
_columns = {
'date_from': fields.date('Start of period', required=True),
'date_to': fields.date('End of period', required=True),
}
}
wizard_report('wizard.analytic.account.budget.report')
_defaults= {
'date_from': time.strftime('%Y-01-01'),
'date_to': 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.budget',
'datas': datas,
}
account_budget_analytic()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="account_budget_analytic_view" model="ir.ui.view">
<field name="name">account.budget.analytic.form</field>
<field name="model">account.budget.analytic</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Select Dates Period">
<field name="date_from"/>
<field name="date_to"/>
<group colspan="4" col="6">
<label string ="" colspan="2"/>
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="check_report" string="Print" type="object" icon="gtk-print" default_focus="1"/>
</group>
</form>
</field>
</record>
<record id="action_account_budget_analytic" model="ir.actions.act_window">
<field name="name">Print Budgets</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.budget.analytic</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="account_budget_analytic_view"/>
<field name="target">new</field>
</record>
<record model="ir.values" id="account_budget_analytic_values">
<field name="model_id" ref="analytic.model_account_analytic_account" />
<field name="object" eval="1" />
<field name="name">Print Budgets</field>
<field name="key2">client_print_multi</field>
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_budget_analytic'))" />
<field name="key">action</field>
<field name="model">account.analytic.account</field>
</record>
</data>
</openerp>

View File

@ -18,38 +18,41 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import time
import wizard
dates_form = '''<?xml version="1.0"?>
<form string="Select Options">
<field name="date_from"/>
<field name="date_to"/>
</form>'''
from osv import fields, osv
dates_fields = {
'date_from': {'string':'Start of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-01-01')},
'date_to': {'string':'End of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
class account_budget_crossvered_report(osv.osv_memory):
}
class wizard_report(wizard.interface):
def _default(self, cr, uid, data, context):
data['form']['report']='analytic-full'
return data['form']
states = {
'init': {
'actions': [_default],
'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[('end','Cancel', 'gtk-cancel'),('report','Print', 'gtk-print', True)]}
},
'report': {
'actions': [],
'result': {'type':'print', 'report':'crossovered.budget.report', 'state':'end'}
_name = 'account.budget.crossvered.report'
_description = 'Account Budget crossvered report'
_columns = {
'date_from': fields.date('Start of period', required=True),
'date_to': fields.date('End of period', required=True),
}
}
wizard_report('wizard.crossovered.budget')
_defaults= {
'date_from': time.strftime('%Y-01-01'),
'date_to': 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': 'crossovered.budge',
'form': data
}
datas['form']['report']='analytic-full'
return {
'type': 'ir.actions.report.xml',
'report_name': 'crossovered.budget.report',
'datas': datas,
}
account_budget_crossvered_report()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="account_budget_crossvered_report_view" model="ir.ui.view">
<field name="name">account.budget.crossvered.report.form</field>
<field name="model">account.budget.crossvered.report</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Select Dates Period">
<field name="date_from"/>
<field name="date_to"/>
<group colspan="4" col="6">
<label string ="" colspan="2"/>
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="check_report" string="Print" type="object" icon="gtk-print" default_focus="1"/>
</group>
</form>
</field>
</record>
<record id="action_account_budget_crossvered_report" model="ir.actions.act_window">
<field name="name">Print Budgets</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.budget.crossvered.report</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="account_budget_crossvered_report_view"/>
<field name="target">new</field>
</record>
<record model="ir.values" id="account_budget_crossvered_report_values">
<field name="model_id" ref="account_budget.model_crossovered_budget" />
<field name="object" eval="1" />
<field name="name">Print Budgets</field>
<field name="key2">client_print_multi</field>
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_budget_crossvered_report'))" />
<field name="key">action</field>
<field name="model">crossovered.budget</field>
</record>
</data>
</openerp>

View File

@ -0,0 +1,61 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 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 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
import time
from osv import fields, osv
class account_budget_crossvered_summary_report(osv.osv_memory):
"""
This wizard provides the crossovered budget summary report'
"""
_name = 'account.budget.crossvered.summary.report'
_description = 'Account Budget crossvered summary report'
_columns = {
'date_from': fields.date('Start of period', required=True),
'date_to': fields.date('End of period', required=True),
}
_defaults= {
'date_from': time.strftime('%Y-01-01'),
'date_to': 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': 'crossovered.budge',
'form': data
}
datas['form']['report']='analytic-one'
return {
'type': 'ir.actions.report.xml',
'report_name': 'crossovered.budget.report',
'datas': datas,
}
return {}
account_budget_crossvered_summary_report()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="account_budget_crossvered_summary_report_view" model="ir.ui.view">
<field name="name">account.budget.crossvered.summary.report.form</field>
<field name="model">account.budget.crossvered.summary.report</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Select Dates Period">
<field name="date_from"/>
<field name="date_to"/>
<group colspan="4" col="6">
<label string ="" colspan="2"/>
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="check_report" string="Print" type="object" icon="gtk-print" default_focus="1"/>
</group>
</form>
</field>
</record>
<record id="action_account_budget_crossvered_summary_report" model="ir.actions.act_window">
<field name="name">Print Summary of Budgets</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.budget.crossvered.summary.report</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="account_budget_crossvered_summary_report_view"/>
<field name="target">new</field>
</record>
<record model="ir.values" id="account_budget_crossvered_summary_report_values">
<field name="model_id" ref="account_budget.model_crossovered_budget" />
<field name="object" eval="1" />
<field name="name">Print Summary of Budgets</field>
<field name="key2">client_print_multi</field>
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_budget_crossvered_summary_report'))" />
<field name="key">action</field>
<field name="model">crossovered.budget</field>
</record>
</data>
</openerp>

View File

@ -0,0 +1,62 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 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 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
import time
from osv import fields, osv
from tools.translate import _
class account_budget_report(osv.osv_memory):
_name = 'account.budget.report'
_description = 'Account Budget report for analytic account'
_columns = {
'date1': fields.date('Start of period', required=True),
'date2': fields.date('End of period', required=True),
}
_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.budget.post',
'form': data
}
data_model = self.pool.get(datas['model']).browse(cr,uid,context['active_id'])
if not data_model.dotation_ids:
raise osv.except_osv(_('Insufficient Data!'),_('No Depreciation or Master Budget Expenses Found on Budget %s!') % data_model.name)
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.budget',
'datas': datas,
}
account_budget_report()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="account_budget_report_view" model="ir.ui.view">
<field name="name">account.budget.report.form</field>
<field name="model">account.budget.report</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Select Dates Period">
<field name="date1"/>
<field name="date2"/>
<group colspan="4" col="6">
<label string ="" colspan="2"/>
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="check_report" string="Print" type="object" icon="gtk-print" default_focus="1"/>
</group>
</form>
</field>
</record>
<record id="action_account_budget_report" model="ir.actions.act_window">
<field name="name">Budgets</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.budget.report</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="account_budget_report_view"/>
<field name="target">new</field>
</record>
<record model="ir.values" id="account_budget_report_values">
<field name="model_id" ref="account_budget.model_account_budget_post" />
<field name="object" eval="1" />
<field name="name">Budgets</field>
<field name="key2">client_print_multi</field>
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_budget_report'))" />
<field name="key">action</field>
<field name="model">account.budget.post</field>
</record>
</data>
</openerp>

View File

@ -18,40 +18,27 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import wizard
import netsvc
from osv import fields, osv
import decimal_precision as dp
_spread_form = '''<?xml version="1.0"?>
<form string="Spread">
<field name="fiscalyear"/>
<field name="amount"/>
</form>'''
class account_budget_spread(osv.osv_memory):
_spread_fields = {
'fiscalyear': {'string':'Fiscal Year', 'type':'many2one', 'relation':'account.fiscalyear', 'required':True},
'amount': {'string':'Amount', 'type':'float', 'digits':(16,2)},
}
_name = 'account.budget.spread'
_description = 'Account Budget spread '
_columns = {
'fiscalyear': fields.many2one('account.fiscalyear','Fiscal Year', required=True),
'amount': fields.float('Amount', digits_compute=dp.get_precision('Account')),
}
class wizard_budget_spread(wizard.interface):
def _spread(self, cr, uid, data, context):
def check_spread(self, cr, uid, ids, context=None):
service = netsvc.LocalService("object_proxy")
form = data['form']
res = service.execute(cr.dbname, uid, 'account.budget.post', 'spread', data['ids'], form['fiscalyear'], form['amount'])
if context is None:
context = {}
data = self.read(cr, uid, ids, [])[0]
res = service.execute(cr.dbname, uid, 'account.budget.post', 'spread', context['active_ids'], data['fiscalyear'], data['amount'])
return {}
states = {
'init': {
'actions': [],
'result': {'type':'form', 'arch':_spread_form, 'fields':_spread_fields, 'state':[('end','Cancel'),('spread','Spread','',True)]}
},
'spread': {
'actions': [_spread],
'result': {'type':'state', 'state':'end'}
}
}
wizard_budget_spread('account.budget.spread')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
account_budget_spread()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="account_budget_spread_view" model="ir.ui.view">
<field name="name">account.budget.spread.form</field>
<field name="model">account.budget.spread</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Select Dates Period">
<field name="fiscalyear"/>
<field name="amount"/>
<group colspan="4" col="6">
<label string ="" colspan="2"/>
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="check_spread" string="Ok" type="object" icon="gtk-ok" default_focus="1"/>
</group>
</form>
</field>
</record>
<record id="action_account_budget_spread" model="ir.actions.act_window">
<field name="name">Spread</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.budget.spread</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="account_budget_spread_view"/>
<field name="target">new</field>
</record>
</data>
</openerp>

View File

@ -1,62 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 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 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
import time
import wizard
import datetime
import pooler
from tools.translate import _
dates_form = '''<?xml version="1.0"?>
<form string="Select period">
<field name="date1"/>
<field name="date2"/>
</form>'''
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 wizard_report(wizard.interface):
def _default(self, cr, uid, data, context):
pool_obj = pooler.get_pool(cr.dbname)
data_model = pool_obj.get(data['model']).browse(cr,uid,data['id'])
if not data_model.dotation_ids:
raise wizard.except_wizard(_('Insufficient Data!'),_('No Depreciation or Master Budget Expenses Found on Budget %s!') % data_model.name)
return data['form']
states = {
'init': {
'actions': [_default],
'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[('end','Cancel', 'gtk-cancel'),('report','Print', 'gtk-print', True)]}
},
'report': {
'actions': [],
'result': {'type':'print', 'report':'account.budget', 'state':'end'}
}
}
wizard_report('account.budget.report')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,54 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 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 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
import time
import wizard
dates_form = '''<?xml version="1.0"?>
<form string="Select Options">
<field name="date_from"/>
<field name="date_to"/>
</form>'''
dates_fields = {
'date_from': {'string':'Start of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-01-01')},
'date_to': {'string':'End of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
}
class wizard_report_summary(wizard.interface):
def _default(self, cr, uid, data, context):
data['form']['report']='analytic-one'
return data['form']
states = {
'init': {
'actions': [_default],
'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[('end','Cancel', 'gtk-cancel'),('report','Print', 'gtk-print', True)]}
},
'report': {
'actions': [],
'result': {'type':'print', 'report':'crossovered.budget.report', 'state':'end'}
}
}
wizard_report_summary('wizard.crossovered.budget.summary')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: