2
from report import report_sxw
5
class reservation_detail_report(report_sxw.rml_parse):
6
def __init__(self, cr, uid, name, context):
7
super(reservation_detail_report, self).__init__(cr, uid, name, context)
9
self.localcontext.update( {
11
'get_data': self.get_data,
12
'get_checkin': self.get_checkin,
13
'get_checkout': self.get_checkout,
14
'get_room':self.get_room,
19
def get_data(self,date_start,date_end):
20
tids = self.pool.get('hotel.reservation').search(self.cr,self.uid,[('checkin', '>=', date_start),('checkout', '<=', date_end)])
21
res = self.pool.get('hotel.reservation').browse(self.cr,self.uid,tids)
25
def get_checkin(self,date_start,date_end):
26
tids = self.pool.get('hotel.reservation').search(self.cr,self.uid,[('checkin', '>=', date_start),('checkin', '<=', date_end)])
27
res = self.pool.get('hotel.reservation').browse(self.cr,self.uid,tids)
31
def get_checkout(self,date_start,date_end):
32
tids = self.pool.get('hotel.reservation').search(self.cr,self.uid,[('checkout', '>=', date_start),('checkout', '<=', date_end)])
33
res = self.pool.get('hotel.reservation').browse(self.cr,self.uid,tids)
37
def get_room(self,date_start,date_end):
39
print "method--------"
40
self.cr.execute("select pt.name,count(pt.name) as No_of_times from hotel_reservation as hr " \
41
"inner join hotel_reservation_line as hrl on hrl.line_id=hr.id " \
42
"inner join hotel_reservation_line_room_rel as hrlrr on hrlrr.room_id=hrl.id " \
43
"inner join product_product as pp on pp.product_tmpl_id=hrlrr.hotel_reservation_line_id " \
44
"inner join product_template as pt on pt.id=pp.product_tmpl_id " \
45
"where hr.state<>'draft' and hr.checkin >= %s and hr.checkout <= %s group by pt.name " \
46
,(date_start,date_end)
49
res2=self.cr.dictfetchall()
55
report_sxw.report_sxw('report.reservation.detail', 'hotel.reservation', 'addons/hotel_reservation/report/room_res.rml',parser= reservation_detail_report)
56
report_sxw.report_sxw('report.checkin.detail', 'hotel.reservation', 'addons/hotel_reservation/report/checkinlist.rml',parser= reservation_detail_report)
57
report_sxw.report_sxw('report.checkout.detail', 'hotel.reservation', 'addons/hotel_reservation/report/checkoutlist.rml',parser= reservation_detail_report)
58
report_sxw.report_sxw('report.maxroom.detail', 'hotel.reservation', 'addons/hotel_reservation/report/maxroom.rml',parser= reservation_detail_report)
b'\\ No newline at end of file'