1
# -*- encoding: utf-8 -*-
2
##############################################################################
4
# Copyright (c) 2009 Dhaval Patel (dhpatel82 at gmail.com)
7
# WARNING: This program as such is intended to be used by professional
8
# programmers who take the whole responsability of assessing all potential
9
# consequences resulting from its eventual inadequacies and bugs
10
# End users who are looking for a ready-to-use solution with commercial
11
# garantees and support are strongly adviced to contract a Free Software
14
# This program is Free Software; you can redistribute it and/or
15
# modify it under the terms of the GNU General Public License
16
# as published by the Free Software Foundation; either version 2
17
# of the License, or (at your option) any later version.
19
# This program is distributed in the hope that it will be useful,
20
# but WITHOUT ANY WARRANTY; without even the implied warranty of
21
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
# GNU General Public License for more details.
24
# You should have received a copy of the GNU General Public License
25
# along with this program; if not, write to the Free Software
26
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28
##############################################################################
30
from report import report_sxw
34
class res_car_document_expiry_report(report_sxw.rml_parse):
36
def __init__(self, cr, uid, name, context):
37
super(res_car_document_expiry_report, self).__init__(cr, uid, name, context=context)
40
self.localcontext.update({
42
'get_car': self.get_car,
43
'get_car_documents': self.get_car_documents,
45
def get_car(self, form):
48
car = pooler.get_pool(self.cr.dbname).get('res.car')
50
result = car.browse(self.cr,self.uid, car_ids)
51
self.date_from = form['date_from']
52
self.date_to = form['date_to']
54
def get_car_documents(self, obj):
57
doc = pooler.get_pool(self.cr.dbname).get('res.car.document')
58
doc_ids = doc.search(self.cr, self.uid, [('car_id','=',obj.id), ('valid_end_date', '>=', self.date_from), ('valid_end_date', '<=', self.date_to)])
59
result = doc.browse(self.cr, self.uid, doc_ids)
62
report_sxw.report_sxw('report.res.car.document.expiry', 'res.car', 'addons/hr_auto/report/res_car_document_expiry_report.rml', parser=res_car_document_expiry_report, header='internal')
64
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: