1
# -*- coding: utf-8 -*-
2
##############################################################################
4
# OpenERP, Open Source Management Solution
5
# Copyright (C) 2012 credativ (<http://www.credativ.co.uk>).
7
# This program is free software: you can redistribute it and/or modify
8
# it under the terms of the GNU Affero General Public License as
9
# published by the Free Software Foundation, either version 3 of the
10
# License, or (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 Affero General Public License for more details.
17
# You should have received a copy of the GNU Affero General Public License
18
# along with this program. If not, see <http://www.gnu.org/licenses/>.
20
##############################################################################
22
from osv import fields, osv
24
class date_wizard(osv.osv_memory):
25
_name = "base_report_creator.date_wizard"
26
_description = "Enter Dates for Report"
28
'from_menu':fields.boolean('From a menu item?'),
29
'from_date':fields.date('Date From', required=True),
30
'to_date':fields.date('Date To', required=True),
36
def report_run(self, cr, uid, ids, context=None):
37
data = self.browse(cr, uid, ids, context=context)
38
report_id = context.get('report_id', False)
39
obj_board = self.pool.get('base_report_creator.report')
40
data_obj = self.pool.get('ir.model.data')
44
board = obj_board.browse(cr, uid, report_id, context=context)
45
view = board.view_type1
47
view += ',' + board.view_type2
49
view += ',' + board.view_type3
50
result = data_obj._get_id(cr, uid, 'base_report_creator', 'view_report_filter')
51
res = data_obj.read(cr, uid, result, ['res_id'])
57
'res_model': 'base_report_creator_report.result',
58
'search_view_id': res['res_id'],
59
'type': 'ir.actions.act_window',
62
if result and data and data[0].from_date and data[0].to_date and context.get('report_id', False):
63
result['context'] = repr({
64
'report_id': board.id,
66
'from_date': data[0].from_date,
67
'to_date': data[0].to_date,
72
# We should log an error here
73
return {'type': 'ir.actions.act_window_close'}
77
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: