2
##############################################################################
4
# OpenERP, Open Source Management Solution
5
# Copyright (C) 2014 MSF, TeMPO consulting
7
# This program is free software: you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License as published by
9
# the Free Software Foundation, either version 3 of the License, or
10
# (at your option) any later version.
12
# This program is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
17
# You should have received a copy of the GNU General Public License
18
# along with this program. If not, see <http://www.gnu.org/licenses/>.
20
##############################################################################
22
from osv import fields
24
class monthly_budget_wizard(osv.osv_memory):
25
_name = "monthly.budget.wizard"
28
'granularity': fields.selection([
29
('view','By parent account'),
30
('expense','By expense'),
31
('all','By expense and destination'),
32
], 'Granularity', select=1, required=True),
33
'extension': fields.selection([('xls', 'XLS'), ('pdf', 'PDF')], 'Format', select=1, required=True),
37
'granularity': lambda *a: 'view',
38
'format': lambda *a: 'xls',
41
def button_confirm(self, cr, uid, ids, context=None):
43
Launch monthly budget generation using given granularity and given format.
45
report_name = 'msf.pdf.budget.monthly'
46
wizard = self.browse(cr, uid, ids[0], context=context)
47
if wizard.extension == 'xls':
48
report_name = 'xls.budget.monthly'
50
data['ids'] = context.get('active_ids', [])
51
if 'active_id' in context:
54
data['form'].update({'granularity': wizard.granularity})
55
if not 'context' in data:
57
data['context'].update(data['form'])
59
return {'type': 'ir.actions.report.xml', 'report_name': report_name, 'datas': data, 'context': context}
61
monthly_budget_wizard()
62
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: