diff --git a/board_frontdesk/__init__.py b/board_frontdesk/__init__.py index af4ddbb..d5a1682 100644 --- a/board_frontdesk/__init__.py +++ b/board_frontdesk/__init__.py @@ -1,20 +1,22 @@ # -*- encoding: utf-8 -*- -############################################################################## -# +############################################################################# +# # OpenERP, Open Source Management Solution -# Copyright (C) 2004-2009 Tiny SPRL (). +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () +# Copyright (C) 2004 OpenERP SA () # # 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. +# it under the terms of the GNU 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. +# GNU 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 . +# You should have received a copy of the GNU General Public License +# along with this program. If not, see # -############################################################################## \ No newline at end of file +############################################################################# diff --git a/board_frontdesk/__openerp__.py b/board_frontdesk/__openerp__.py index 3dc24da..c8ebdc1 100644 --- a/board_frontdesk/__openerp__.py +++ b/board_frontdesk/__openerp__.py @@ -1,23 +1,26 @@ # -*- encoding: utf-8 -*- -############################################################################## -# +############################################################################# +# # OpenERP, Open Source Management Solution -# Copyright (C) 2004-2009 Tiny SPRL (). +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () +# Copyright (C) 2004 OpenERP SA () # # 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. +# it under the terms of the GNU 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. +# GNU 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 . +# You should have received a copy of the GNU General Public License +# along with this program. If not, see # -############################################################################## +############################################################################# + { "name": "Board for Hotel FrontDesk", "version": "1.0", @@ -40,3 +43,5 @@ "active": False, "installable": True, } + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/board_frontdesk/views/board_frontdesk_view.xml b/board_frontdesk/views/board_frontdesk_view.xml index e81aa52..b2f9dd5 100644 --- a/board_frontdesk/views/board_frontdesk_view.xml +++ b/board_frontdesk/views/board_frontdesk_view.xml @@ -108,8 +108,6 @@ - - ) +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,7 +19,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################# from . import models from . import wizard diff --git a/hotel/__openerp__.py b/hotel/__openerp__.py index 8896ed1..bede991 100644 --- a/hotel/__openerp__.py +++ b/hotel/__openerp__.py @@ -1,8 +1,9 @@ -# -*- coding: utf-8 -*- -############################################################################## +# -*- encoding: utf-8 -*- +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,7 +19,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################# { "name": "Hotel Management", @@ -36,7 +37,7 @@ Different reports are also provided, mainly for hotel statistics. """, "website": ["http://www.serpentcs.com", "http://www.openerp.com"], - "depends": ["sale_stock", "report_extended" , "point_of_sale"], + "depends": ["sale_stock", "report_extended", "point_of_sale"], "demo": ["views/hotel_data.xml"], "data": [ "security/hotel_security.xml", diff --git a/hotel/models/__init__.py b/hotel/models/__init__.py index 1b3febe..3c63f07 100644 --- a/hotel/models/__init__.py +++ b/hotel/models/__init__.py @@ -1,8 +1,9 @@ -# -*- coding: utf-8 -*- -############################################################################## +# -*- encoding: utf-8 -*- +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,6 +19,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################# from . import hotel + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/hotel/models/hotel.py b/hotel/models/hotel.py index 8bcd37d..3687163 100644 --- a/hotel/models/hotel.py +++ b/hotel/models/hotel.py @@ -1,8 +1,9 @@ -# -*- coding: utf-8 -*- -############################################################################## +# -*- encoding: utf-8 -*- +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -10,7 +11,6 @@ # 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 @@ -19,7 +19,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################# from openerp.exceptions import except_orm, Warning, ValidationError from openerp.tools import misc, DEFAULT_SERVER_DATETIME_FORMAT from openerp import models, fields, api, _, netsvc @@ -52,7 +52,8 @@ class hotel_room_type(models.Model): _name = "hotel.room.type" _description = "Room Type" - cat_id = fields.Many2one('product.category', 'category', required=True, delegate=True, select=True, ondelete='cascade') + cat_id = fields.Many2one('product.category', 'category', required=True, + delegate=True, select=True, ondelete='cascade') class product_product(models.Model): @@ -69,7 +70,8 @@ class hotel_room_amenities_type(models.Model): _name = 'hotel.room.amenities.type' _description = 'amenities Type' - cat_id = fields.Many2one('product.category', 'category', required=True, delegate=True, ondelete='cascade') + cat_id = fields.Many2one('product.category', 'category', required=True, + delegate=True, ondelete='cascade') class hotel_room_amenities(models.Model): @@ -77,8 +79,11 @@ class hotel_room_amenities(models.Model): _name = 'hotel.room.amenities' _description = 'Room amenities' - room_categ_id = fields.Many2one('product.product', 'Product Category' , required=True, delegate=True, ondelete='cascade') - rcateg_id = fields.Many2one('hotel.room.amenities.type', 'Amenity Catagory') + room_categ_id = fields.Many2one('product.product', 'Product Category', + required=True, delegate=True, + ondelete='cascade') + rcateg_id = fields.Many2one('hotel.room.amenities.type', + 'Amenity Catagory') class folio_room_line(models.Model): @@ -99,14 +104,23 @@ class hotel_room(models.Model): _name = 'hotel.room' _description = 'Hotel Room' - product_id = fields.Many2one('product.product', 'Product_id' , required=True, delegate=True, ondelete='cascade') - floor_id = fields.Many2one('hotel.floor', 'Floor No', help='At which floor the room is located.') + product_id = fields.Many2one('product.product', 'Product_id', + required=True, delegate=True, + ondelete='cascade') + floor_id = fields.Many2one('hotel.floor', 'Floor No', + help='At which floor the room is located.') max_adult = fields.Integer('Max Adult') max_child = fields.Integer('Max Child') - room_amenities = fields.Many2many('hotel.room.amenities', 'temp_tab', 'room_amenities', 'rcateg_id', string='Room Amenities', help='List of room amenities. ') - status = fields.Selection([('available', 'Available'), ('occupied', 'Occupied')], 'Status', default='available') + room_amenities = fields.Many2many('hotel.room.amenities', 'temp_tab', + 'room_amenities', 'rcateg_id', + string='Room Amenities', + help='List of room amenities. ') + status = fields.Selection([('available', 'Available'), + ('occupied', 'Occupied')], + 'Status', default='available') capacity = fields.Integer('Capacity') - room_line_ids = fields.One2many('folio.room.line', 'room_id', string='Room Reservation Line') + room_line_ids = fields.One2many('folio.room.line', 'room_id', + string='Room Reservation Line') @api.onchange('isroom') def isroom_change(self): @@ -199,7 +213,7 @@ def _invoiced(self, name, arg): return self.env['sale.order']._invoiced(name, arg) @api.multi - def _invoiced_search(self , obj, name, args): + def _invoiced_search(self, obj, name, args): ''' @param self : object pointer @param name: Names of fields. @@ -214,16 +228,39 @@ def _invoiced_search(self , obj, name, args): _inherit = ['ir.needaction_mixin'] name = fields.Char('Folio Number', readonly=True) - order_id = fields.Many2one('sale.order', 'Order', delegate=True, required=True, ondelete='cascade') - checkin_date = fields.Datetime('Check In', required=True, readonly=True, states={'draft':[('readonly', False)]}) - checkout_date = fields.Datetime('Check Out', required=True, readonly=True, states={'draft':[('readonly', False)]}) - room_lines = fields.One2many('hotel.folio.line', 'folio_id', readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}, help="Hotel room reservation detail.") - service_lines = fields.One2many('hotel.service.line', 'folio_id', readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}, help="Hotel services detail provide to customer and it will include in main Invoice.") - hotel_policy = fields.Selection([('prepaid', 'On Booking'), ('manual', 'On Check In'), ('picking', 'On Checkout')], 'Hotel Policy', default='manual', help="Hotel policy for payment that either the guest has to payment at booking time or check-in check-out time.") - duration = fields.Float('Duration in Days', help="Number of days which will automatically count from the check-in and check-out date. ") - currrency_ids = fields.One2many('currency.exchange', 'folio_no', readonly=True) + order_id = fields.Many2one('sale.order', 'Order', delegate=True, + required=True, ondelete='cascade') + checkin_date = fields.Datetime('Check In', required=True, readonly=True, + states={'draft':[('readonly', False)]}) + checkout_date = fields.Datetime('Check Out', required=True, readonly=True, + states={'draft':[('readonly', False)]}) + room_lines = fields.One2many('hotel.folio.line', 'folio_id', + readonly=True, + states={'draft': [('readonly', False)], + 'sent': [('readonly', False)]}, + help="Hotel room reservation detail.") + service_lines = fields.One2many('hotel.service.line', 'folio_id', + readonly=True, + states={'draft': [('readonly', False)], + 'sent': [('readonly', False)]}, + help="Hotel services detail provide to \ +customer and it will include in main Invoice.") + + hotel_policy = fields.Selection([('prepaid', 'On Booking'), + ('manual', 'On Check In'), + ('picking', 'On Checkout')], + 'Hotel Policy', default='manual', + help="Hotel policy for payment that either \ +the guest has to payment at booking time or check-in check-out time.") + duration = fields.Float('Duration in Days', + help="Number of days which will automatically \ +count from the check-in and check-out date. ") + currrency_ids = fields.One2many('currency.exchange', 'folio_no', + readonly=True) hotel_invoice_id = fields.Many2one('account.invoice', 'Invoice') - folio_pos_order_ids = fields.Many2many('pos.order', 'hotel_pos_rel', 'hotel_folio_id', 'pos_id', 'Orders', readonly=True) + folio_pos_order_ids = fields.Many2many('pos.order', 'hotel_pos_rel', + 'hotel_folio_id', 'pos_id', + 'Orders', readonly=True) @api.multi def go_to_currency_exchange(self): @@ -236,7 +273,9 @@ def go_to_currency_exchange(self): context = dict(context) for rec in self: if rec.partner_id.id and len(rec.room_lines) != 0: - context.update({'folioid':rec.id, 'guest':rec.partner_id.id, 'room_no':rec.room_lines[0].product_id.name, 'hotel':rec.warehouse_id.id}) + context.update({'folioid':rec.id, 'guest':rec.partner_id.id, + 'room_no':rec.room_lines[0].product_id.name, + 'hotel':rec.warehouse_id.id}) self.env.args = cr, uid, misc.frozendict(context) else: raise except_orm(_('Warning'), _('Please Reserve Any Room.')) @@ -247,8 +286,12 @@ def go_to_currency_exchange(self): 'view_id': False, 'view_mode': 'form,tree', 'view_type': 'form', - 'context':{'default_folio_no':context.get('folioid'), 'default_hotel_id':context.get('hotel'), 'default_guest_name':context.get('guest'), 'default_room_number':context.get('room_no')}, - } + 'context':{'default_folio_no':context.get('folioid'), + 'default_hotel_id':context.get('hotel'), + 'default_guest_name':context.get('guest'), + 'default_room_number':context.get('room_no') + }, + } @api.constrains('room_lines') def folio_room_lines(self): @@ -273,18 +316,22 @@ def check_dates(self): @return : raise warning depending on the validation ''' if self.checkin_date >= self.checkout_date: - raise ValidationError(_('Check in Date Should be less than the Check Out Date!')) + raise ValidationError(_('Check in Date Should be \ + less than the Check Out Date!')) if self.date_order and self.checkin_date: if self.checkin_date < self.date_order: - raise ValidationError(_('Check in date should be greater than the current date.')) + raise ValidationError(_('Check in date should be \ + greater than the current date.')) @api.onchange('checkout_date', 'checkin_date') def onchange_dates(self): ''' - This mathod gives the duration between check in and checkout if customer will leave only for some - hour it would be considers as a whole day. If customer will check in checkout for more or equal - hours , which configured in company as additional hours than it would be consider as full days - --------------------------------------------------------------------------------------------- + This mathod gives the duration between check in and checkout + if customer will leave only for some hour it would be considers + as a whole day.If customer will check in checkout for more or equal + hours, which configured in company as additional hours than it would + be consider as full days + -------------------------------------------------------------------- @param self : object pointer @return : Duration and checkout_date ''' @@ -294,10 +341,12 @@ def onchange_dates(self): company_ids = company_obj.search([]) if company_ids.ids: configured_addition_hours = company_ids[0].additional_hours - myduration = 0 + myduration = 0 if self.checkin_date and self.checkout_date: - chkin_dt = datetime.datetime.strptime(self.checkin_date, DEFAULT_SERVER_DATETIME_FORMAT) - chkout_dt = datetime.datetime.strptime(self.checkout_date, DEFAULT_SERVER_DATETIME_FORMAT) + chkin_dt = (datetime.datetime.strptime + (self.checkin_date,DEFAULT_SERVER_DATETIME_FORMAT)) + chkout_dt = (datetime.datetime.strptime + (self.checkout_date, DEFAULT_SERVER_DATETIME_FORMAT)) dur = chkout_dt - chkin_dt myduration = dur.days + 1 if configured_addition_hours > 0: @@ -307,7 +356,9 @@ def onchange_dates(self): self.duration = myduration if self.reservation_id: for reservation in self.reservation_id: - reservation_obj = reservation_line_obj.search([('reservation_id', '=', reservation.id)]) + reservation_obj = (reservation_line_obj.search + ([('reservation_id', '=', + reservation.id)])) if len(reservation_obj) == 1: for line_id in reservation.reservation_line: line_id = line_id.reserve @@ -343,21 +394,22 @@ def create(self, vals, check=True): vals = {} vals['name'] = self.env['ir.sequence'].get('hotel.folio') folio_id = super(hotel_folio, self).create(vals) - folio_room_line_obj = self.env['folio.room.line'] + folio_room_line_obj = self.env['folio.room.line'] + h_room_obj = self.env['hotel.room'] room_lst = [] for rec in folio_id: if not rec.reservation_id: for room_rec in rec.room_lines: room_lst.append(room_rec.product_id) - for rom in room_lst: - room_obj = self.env['hotel.room'].search([('name', '=', rom.name)]) + for rm in room_lst: + room_obj = h_room_obj.search([('name', '=', rm.name)]) room_obj.write({'isroom':False}) vals = { 'room_id': room_obj.id, 'check_in': rec.checkin_date, 'check_out': rec.checkout_date, 'folio_id': rec.id, - } + } folio_room_line_obj.create(vals) return folio_id @@ -370,7 +422,7 @@ def write(self, vals): """ folio_room_line_obj = self.env['folio.room.line'] product_obj = self.env['product.product'] - hotel_room_obj = self.env['hotel.room'] + h_room_obj = self.env['hotel.room'] room_lst1 = [] for rec in self: for res in rec.room_lines: @@ -383,8 +435,8 @@ def write(self, vals): new_rooms = set(room_lst).difference(set(room_lst1)) if len(list(new_rooms)) != 0: room_list = product_obj.browse(list(new_rooms)) - for rom in room_list: - room_obj = hotel_room_obj.search([('name', '=', rom.name)]) + for rm in room_list: + room_obj = h_room_obj.search([('name', '=', rm.name)]) room_obj.write({'isroom':False}) vals = { 'room_id': room_obj.id, @@ -396,16 +448,17 @@ def write(self, vals): if len(list(new_rooms)) == 0: room_list_obj = product_obj.browse(room_lst1) for rom in room_list_obj: - room_obj = hotel_room_obj.search([('name', '=', rom.name)]) + room_obj = h_room_obj.search([('name', '=', rom.name)]) room_obj.write({'isroom':False}) room_vals = { 'room_id': room_obj.id, 'check_in': folio_obj.checkin_date, 'check_out': folio_obj.checkout_date, 'folio_id': folio_obj.id, - } - folio_room_line_rec = folio_room_line_obj.search([('folio_id', '=', folio_obj.id)]) - folio_room_line_rec.write(room_vals) + } + folio_romline_rec = (folio_room_line_obj.search + ([('folio_id', '=', folio_obj.id)])) + folio_romline_rec.write(room_vals) return folio_write @api.onchange('warehouse_id') @@ -442,7 +495,7 @@ def onchange_partner_id(self): self.partner_shipping_id = partner_rec.id self.pricelist_id = partner_rec.property_product_pricelist.id - @api.multi + @api.multi def button_dummy(self): ''' @param self : object pointer @@ -453,7 +506,8 @@ def button_dummy(self): return x @api.multi - def action_invoice_create(self, grouped=False, states=['confirmed', 'done']): + def action_invoice_create(self, grouped=False, + states=['confirmed', 'done']): ''' @param self : object pointer ''' @@ -461,7 +515,8 @@ def action_invoice_create(self, grouped=False, states=['confirmed', 'done']): order_ids = [folio.order_id.id for folio in self] room_lst = [] sale_obj = self.env['sale.order'].browse(order_ids) - invoice_id = sale_obj.action_invoice_create(grouped=False, states=['confirmed', 'done']) + invoice_id = (sale_obj.action_invoice_create + (grouped=False, states=['confirmed', 'done'])) for line in self: values = { 'invoiced': True, @@ -478,7 +533,8 @@ def action_invoice_create(self, grouped=False, states=['confirmed', 'done']): for rec in line.room_lines: room_lst.append(rec.product_id) for room in room_lst: - room_obj = self.env['hotel.room'].search([('name', '=', room.name)]) + room_obj = self.env['hotel.room' + ].search([('name', '=', room.name)]) room_obj.write({'isroom':True}) return invoice_id @@ -507,9 +563,12 @@ def action_cancel(self): wf_service = netsvc.LocalService("workflow") for sale in self: for pick in sale.picking_ids: - wf_service.trg_validate(self._uid, 'stock.picking', pick.id, 'button_cancel', self._cr) + wf_service.trg_validate(self._uid, 'stock.picking', pick.id, + 'button_cancel', self._cr) for invoice in sale.invoice_ids: - wf_service.trg_validate(self._uid, 'account.invoice', invoice.id, 'invoice_cancel', self._cr) + wf_service.trg_validate(self._uid, 'account.invoice', + invoice.id, 'invoice_cancel', + self._cr) sale.write({'state':'cancel'}) for rec in sale.folio_pos_order_ids: rec.write({'state':'cancel'}) @@ -582,20 +641,23 @@ def action_cancel_draft(self): ''' if not len(self._ids): return False - query = "select id from sale_order_line where order_id IN %s and state=%s" + query = "select id from sale_order_line \ + where order_id IN %s and state=%s" self._cr.execute(query, (tuple(self._ids), 'cancel')) cr1 = self._cr line_ids = map(lambda x: x[0], cr1.fetchall()) self.write({'state': 'draft', 'invoice_ids': [], 'shipped': 0}) sale_line_obj = self.env['sale.order.line'].browse(line_ids) - sale_line_obj.write({'invoiced': False, 'state': 'draft', 'invoice_lines': [(6, 0, [])]}) + sale_line_obj.write({'invoiced': False, 'state': 'draft', + 'invoice_lines': [(6, 0, [])]}) wf_service = netsvc.LocalService("workflow") for inv_id in self._ids: # Deleting the existing instance of workflow for SO wf_service.trg_delete(self._uid, 'sale.order', inv_id, self._cr) wf_service.trg_create(self._uid, 'sale.order', inv_id, self._cr) for (id, name) in self.name_get(): - message = _("The sales order '%s' has been set in draft state.") % (name,) + message = _("The sales order '%s' has been set in \ + draft state.") % (name,) self.log(message) return True @@ -643,10 +705,15 @@ def _get_checkout_date(self): _name = 'hotel.folio.line' _description = 'hotel folio1 room line' - order_line_id = fields.Many2one('sale.order.line', string='Order Line' , required=True, delegate=True, ondelete='cascade') - folio_id = fields.Many2one('hotel.folio', string='Folio', ondelete='cascade') - checkin_date = fields.Datetime('Check In', required=True, default=_get_checkin_date) - checkout_date = fields.Datetime('Check Out', required=True, default=_get_checkout_date) + order_line_id = fields.Many2one('sale.order.line', string='Order Line', + required=True, delegate=True, + ondelete='cascade') + folio_id = fields.Many2one('hotel.folio', string='Folio', + ondelete='cascade') + checkin_date = fields.Datetime('Check In', required=True, + default=_get_checkin_date) + checkout_date = fields.Datetime('Check Out', required=True, + default=_get_checkout_date) @api.model def create(self, vals, check=True): @@ -669,18 +736,23 @@ def unlink(self): @return: True/False. """ sale_line_obj = self.env['sale.order.line'] - folio_room_line_obj = self.env['folio.room.line'] + fr_obj = self.env['folio.room.line'] for line in self: if line.order_line_id: - sale_unlink_obj = sale_line_obj.browse([line.order_line_id.id]) + sale_unlink_obj = (sale_line_obj.browse + ([line.order_line_id.id])) for rec in sale_unlink_obj: - room_obj = self.env['hotel.room'].search([('name', '=', rec.name)]) + room_obj = self.env['hotel.room' + ].search([('name', '=', rec.name)]) if room_obj.id: + folio_arg = [('folio_id', '=', line.folio_id.id), + ('room_id', '=', room_obj.id)] for room_line in room_obj.room_line_ids: - folio_room_line_myobj = folio_room_line_obj.search([('folio_id', '=', line.folio_id.id), ('room_id', '=', room_obj.id)]) + folio_room_line_myobj = fr_obj.search(folio_arg) if folio_room_line_myobj.id: folio_room_line_myobj.unlink() - room_obj.write({'isroom':True, 'status':'available'}) + room_obj.write({'isroom':True, + 'status':'available'}) sale_unlink_obj.unlink() return super(hotel_folio_line, self).unlink() @@ -691,7 +763,8 @@ def uos_change(self, product_uos, product_uos_qty=0, product_id=None): ''' for folio in self: line = folio.order_line_id - x = line.uos_change(product_uos, product_uos_qty=0, product_id=None) + x = line.uos_change(product_uos, product_uos_qty=0, + product_id=None) return x @api.multi @@ -705,8 +778,9 @@ def product_id_change(self, pricelist, product, qty=0, if product: sale_line_obj = self.env['sale.order.line'].browse(line_ids) return sale_line_obj.product_id_change(pricelist, product, qty=0, - uom=False, qty_uos=0, uos=False, name='', partner_id=partner_id, - lang=False, update_tax=True, date_order=False) + uom=False, qty_uos=0, uos=False, name='', + partner_id=partner_id,lang=False, + update_tax=True, date_order=False) @api.multi def product_uom_change(self, pricelist, product, qty=0, @@ -717,8 +791,10 @@ def product_uom_change(self, pricelist, product, qty=0, ''' if product: return self.product_id_change(pricelist, product, qty=0, - uom=False, qty_uos=0, uos=False, name='', partner_id=partner_id, - lang=False, update_tax=True, date_order=False) + uom=False, qty_uos=0, uos=False, name='', + partner_id=partner_id,lang=False, + update_tax=True, date_order=False) + @api.onchange('checkin_date', 'checkout_date') def on_change_checkout(self): @@ -733,9 +809,14 @@ def on_change_checkout(self): if not self.checkout_date: self.checkout_date = time.strftime(DEFAULT_SERVER_DATETIME_FORMAT) if self.checkout_date < self.checkin_date: - raise except_orm(_('Warning'), _('Checkout must be greater or equal to checkin date')) + raise except_orm(_('Warning'), _('Checkout must be greater or \ + equal to checkin date')) if self.checkin_date and self.checkout_date: - diffDate = datetime.datetime(*time.strptime(self.checkout_date, DEFAULT_SERVER_DATETIME_FORMAT)[:5]) - datetime.datetime(*time.strptime(self.checkin_date, DEFAULT_SERVER_DATETIME_FORMAT)[:5]) + date_a = time.strptime(self.checkout_date, + DEFAULT_SERVER_DATETIME_FORMAT)[:5] + date_b = time.strptime(self.checkin_date, + DEFAULT_SERVER_DATETIME_FORMAT)[:5] + diffDate = datetime.datetime(*date_a) - datetime.datetime(*date_b) qty = diffDate.days + 1 self.product_uom_qty = qty @@ -760,7 +841,8 @@ def button_done(self): wf_service = netsvc.LocalService("workflow") res = self.write({'state':'done'}) for line in self: - wf_service.trg_write(self._uid, 'sale.order', line.order_line_id.order_id.id, self._cr) + wf_service.trg_write(self._uid, 'sale.order', + line.order_line_id.order_id.id, self._cr) return res @api.one @@ -825,10 +907,14 @@ def _service_checkout_date(self): _name = 'hotel.service.line' _description = 'hotel Service line' - service_line_id = fields.Many2one('sale.order.line', 'Service Line', required=True, delegate=True, ondelete='cascade') + service_line_id = fields.Many2one('sale.order.line', 'Service Line', + required=True, delegate=True, + ondelete='cascade') folio_id = fields.Many2one('hotel.folio', 'Folio', ondelete='cascade') - ser_checkin_date = fields.Datetime('From Date', required=True, default=_service_checkin_date) - ser_checkout_date = fields.Datetime('To Date', required=True, default=_service_checkout_date) + ser_checkin_date = fields.Datetime('From Date', required=True, + default=_service_checkin_date) + ser_checkout_date = fields.Datetime('To Date', required=True, + default=_service_checkout_date) @api.model def create(self, vals, check=True): @@ -838,7 +924,6 @@ def create(self, vals, check=True): @param vals: dictionary of fields value. @return: new record set for hotel service line. """ - if 'folio_id' in vals: folio = self.env['hotel.folio'].browse(vals['folio_id']) vals.update({'order_id':folio.order_id.id}) @@ -851,10 +936,10 @@ def unlink(self): @param self: The object pointer @return: True/False. """ - sale_line_obj = self.env['sale.order.line'] + s_line_obj = self.env['sale.order.line'] for line in self: if line.service_line_id: - sale_unlink_obj = sale_line_obj.browse([line.service_line_id.id]) + sale_unlink_obj = s_line_obj.browse([line.service_line_id.id]) sale_unlink_obj.unlink() return super(hotel_service_line, self).unlink() @@ -869,8 +954,9 @@ def product_id_change(self, pricelist, product, qty=0, if product: sale_line_obj = self.env['sale.order.line'].browse(line_ids) return sale_line_obj.product_id_change(pricelist, product, qty=0, - uom=False, qty_uos=0, uos=False, name='', partner_id=partner_id, - lang=False, update_tax=True, date_order=False) + uom=False, qty_uos=0, uos=False, name='', + partner_id=partner_id, lang=False, update_tax=True, + date_order=False) @api.multi def product_uom_change(self, pricelist, product, qty=0, @@ -881,8 +967,9 @@ def product_uom_change(self, pricelist, product, qty=0, ''' if product: return self.product_id_change(pricelist, product, qty=0, - uom=False, qty_uos=0, uos=False, name='', partner_id=partner_id, - lang=False, update_tax=True, date_order=False) + uom=False, qty_uos=0, uos=False, name='', + partner_id=partner_id, lang=False, update_tax=True, + date_order=False) @api.onchange('ser_checkin_date', 'ser_checkout_date') def on_change_checkout(self): @@ -893,13 +980,18 @@ def on_change_checkout(self): @param self : object pointer ''' if not self.ser_checkin_date: - self.ser_checkin_date = time.strftime(DEFAULT_SERVER_DATETIME_FORMAT) + time_a = time.strftime(DEFAULT_SERVER_DATETIME_FORMAT) + self.ser_checkin_date = time_a if not self.ser_checkout_date: - self.ser_checkout_date = time.strftime(DEFAULT_SERVER_DATETIME_FORMAT) + self.ser_checkout_date = time_a if self.ser_checkout_date < self.ser_checkin_date: raise Warning('Checkout must be greater or equal checkin date') if self.ser_checkin_date and self.ser_checkout_date: - diffDate = datetime.datetime(*time.strptime(self.ser_checkout_date, DEFAULT_SERVER_DATETIME_FORMAT)[:5]) - datetime.datetime(*time.strptime(self.ser_checkin_date, DEFAULT_SERVER_DATETIME_FORMAT)[:5]) + date_a = time.strptime(self.ser_checkout_date, + DEFAULT_SERVER_DATETIME_FORMAT)[:5] + date_b = time.strptime(self.ser_checkin_date, + DEFAULT_SERVER_DATETIME_FORMAT)[:5] + diffDate = datetime.datetime(*date_a) - datetime.datetime(*date_b) qty = diffDate.days + 1 self.product_uom_qty = qty @@ -929,7 +1021,8 @@ def copy_data(self, default=None): @param self : object pointer @param default : dict of default values to be set ''' - sale_line_obj = self.env['sale.order.line'].browse(self.service_line_id.id) + sale_line_obj = self.env['sale.order.line' + ].browse(self.service_line_id.id) return sale_line_obj.copy_data(default=default) @@ -938,7 +1031,8 @@ class hotel_service_type(models.Model): _name = "hotel.service.type" _description = "Service Type" - ser_id = fields.Many2one('product.category', 'category', required=True, delegate=True, select=True, ondelete='cascade') + ser_id = fields.Many2one('product.category', 'category', required=True, + delegate=True, select=True, ondelete='cascade') class hotel_services(models.Model): @@ -946,14 +1040,19 @@ class hotel_services(models.Model): _name = 'hotel.services' _description = 'Hotel Services and its charges' - service_id = fields.Many2one('product.product', 'Service_id', required=True, ondelete='cascade', delegate=True) + service_id = fields.Many2one('product.product', 'Service_id', + required=True, ondelete='cascade', + delegate=True) class res_company(models.Model): _inherit = 'res.company' - additional_hours = fields.Integer('Additional Hours', help="Provide the min hours value for check in, checkout days, whatever the hours will be provided here based on that extra days will be calculated.") + additional_hours = fields.Integer('Additional Hours', + help="Provide the min hours value for \ +check in, checkout days, whatever the hours will be provided here based \ +on that extra days will be calculated.") class CurrencyExchangeRate(models.Model): @@ -962,19 +1061,27 @@ class CurrencyExchangeRate(models.Model): _description = "currency" name = fields.Char('Reg Number', readonly=True) - today_date = fields.Datetime('Date Ordered', required=True, default=lambda *a: time.strftime(DEFAULT_SERVER_DATETIME_FORMAT)) - input_curr = fields.Many2one('res.currency', string='Input Currency', track_visibility='always') - in_amount = fields.Float('Amount Taken', size=64 , default=1.0) - out_curr = fields.Many2one('res.currency', string='Output Currency', track_visibility='always') + today_date = fields.Datetime('Date Ordered', + required=True, + default=(lambda *a: + time.strftime + (DEFAULT_SERVER_DATETIME_FORMAT))) + input_curr = fields.Many2one('res.currency', string='Input Currency', + track_visibility='always') + in_amount = fields.Float('Amount Taken', size=64, default=1.0) + out_curr = fields.Many2one('res.currency', string='Output Currency', + track_visibility='always') out_amount = fields.Float('Subtotal', size=64) folio_no = fields.Many2one('hotel.folio', 'Folio Number') guest_name = fields.Many2one('res.partner', string='Guest Name') room_number = fields.Char(string='Room Number') - state = fields.Selection([('draft', 'Draft'), ('done', 'Done'), ('cancel', 'Cancel')], 'State', default='draft') + state = fields.Selection([('draft', 'Draft'), ('done', 'Done'), + ('cancel', 'Cancel')], 'State', default='draft') rate = fields.Float('Rate(per unit)', size=64) hotel_id = fields.Many2one('stock.warehouse', 'Hotel Name') type = fields.Selection([('cash', 'Cash')], 'Type', default='cash') - tax = fields.Selection([('2', '2%'), ('5', '5%'), ('10', '10%')], 'Service Tax', default='2') + tax = fields.Selection([('2', '2%'), ('5', '5%'), ('10', '10%')], + 'Service Tax', default='2') total = fields.Float('Amount Given') @api.model @@ -995,7 +1102,7 @@ def create(self, vals): def get_folio_no(self): ''' When you change folio_no, based on that it will update - the guest_name ,hotel_id and room_number as well + the guest_name,hotel_id and room_number as well --------------------------------------------------------- @param self : object pointer ''' @@ -1049,7 +1156,8 @@ def get_rate(self, a, b): @param self : object pointer ''' try: - url = 'http://finance.yahoo.com/d/quotes.csv?s=%s%s=X&f=l1' % (a, b) + url = 'http://finance.yahoo.com/d/quotes.csv?s=%s%s=X&f=l1' % (a, + b) rate = urllib2.urlopen(url).read().rstrip() return Decimal(rate) except: @@ -1058,7 +1166,7 @@ def get_rate(self, a, b): @api.onchange('input_curr', 'out_curr', 'in_amount') def get_currency(self): ''' - When you change input_curr , out_curr or in_amount + When you change input_curr, out_curr or in_amount it will update the out_amount of the currency exchange ------------------------------------------------------ @param self : object pointer @@ -1066,12 +1174,15 @@ def get_currency(self): self.out_amount = 0.0 if self.input_curr: for rec in self: - result = rec.get_rate(self.input_curr.name, self.out_curr.name) + result = rec.get_rate(self.input_curr.name, + self.out_curr.name) if self.out_curr: - self.rate = result - if self.rate == Decimal('-1.00'): - raise except_orm(_('Warning'), _('Please Check Your Network Connectivity.')) - self.out_amount = (float(result) * float(self.in_amount)) + self.rate = result + if self.rate == Decimal('-1.00'): + raise except_orm(_('Warning'), + _('Please Check Your \ + Network Connectivity.')) + self.out_amount = (float(result) * float(self.in_amount)) @api.onchange('out_amount', 'tax') def tax_change(self): diff --git a/hotel/report/__init__.py b/hotel/report/__init__.py index b0612b4..14055bf 100644 --- a/hotel/report/__init__.py +++ b/hotel/report/__init__.py @@ -1,8 +1,9 @@ -# -*- coding: utf-8 -*- -############################################################################## +# -*- encoding: utf-8 -*- +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,7 +19,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################# from . import hotel_report from . import pos_report diff --git a/hotel/report/hotel_report.py b/hotel/report/hotel_report.py index 84093a3..09887db 100644 --- a/hotel/report/hotel_report.py +++ b/hotel/report/hotel_report.py @@ -1,8 +1,9 @@ -# -*- coding: utf-8 -*- -############################################################################## +# -*- encoding: utf-8 -*- +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,7 +19,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################# import time from openerp import models @@ -32,13 +33,15 @@ def __init__(self, cr, uid, name, context): 'get_data': self.get_data, 'get_Total' : self.getTotal, 'get_total': self.gettotal, - }) + }) self.temp = 0.0 def get_data(self, date_start, date_end): folio_obj = self.pool.get('hotel.folio') partner_obj = self.pool.get('res.partner') - tids = folio_obj.search(self.cr, self.uid, [('checkin_date', '>=', date_start), ('checkout_date', '<=', date_end)]) + tids = folio_obj.search(self.cr, self.uid, + [('checkin_date', '>=', date_start), + ('checkout_date', '<=', date_end)]) res = folio_obj.browse(self.cr, self.uid, tids) res1 = partner_obj.browse(self.cr, self.uid, tids) return res @@ -56,5 +59,4 @@ class report_lunchorder(models.AbstractModel): _template = 'hotel.report_hotel_folio' _wrapped_report_class = folio_report - # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/hotel/report/pos_report.py b/hotel/report/pos_report.py index c2ab54b..7035fb0 100644 --- a/hotel/report/pos_report.py +++ b/hotel/report/pos_report.py @@ -1,8 +1,9 @@ -# -*- coding: utf-8 -*- -############################################################################## +# -*- encoding: utf-8 -*- +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,7 +19,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################# import time from openerp import models @@ -33,12 +34,14 @@ def __init__(self, cr, uid, name, context): 'gettotal': self.gettotal, 'getTotal':self.getTotal, 'get_pos': self.get_pos, - }) + }) self.temp = 0.0 def get_data(self, date_start, date_end): folio_obj = self.pool.get('hotel.folio') - tids = folio_obj.search(self.cr, self.uid, [('checkin_date', '>=', date_start), ('checkout_date', '<=', date_end)]) + tids = folio_obj.search(self.cr, self.uid, + [('checkin_date', '>=', date_start), + ('checkout_date', '<=', date_end)]) res = folio_obj.browse(self.cr, self.uid, tids) folio_ids = [] for rec in res: @@ -48,7 +51,9 @@ def get_data(self, date_start, date_end): def get_pos(self, date_start, date_end): folio_obj = self.pool.get('hotel.folio') - tids = folio_obj.search(self.cr, self.uid, [('checkin_date', '>=', date_start), ('checkout_date', '<=', date_end)]) + tids = folio_obj.search(self.cr, self.uid, + [('checkin_date', '>=', date_start), + ('checkout_date', '<=', date_end)]) res = folio_obj.browse(self.cr, self.uid, tids) posorder_ids = [] for rec in res: @@ -72,5 +77,4 @@ class report_lunchorder1(models.AbstractModel): _template = 'hotel.report_hotel_folio_pos' _wrapped_report_class = folio_report1 - # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/hotel/wizard/__init__.py b/hotel/wizard/__init__.py index ef92ca8..c6a70e4 100644 --- a/hotel/wizard/__init__.py +++ b/hotel/wizard/__init__.py @@ -1,8 +1,9 @@ # -*- encoding: utf-8 -*- -############################################################################## +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,7 +19,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################# from . import hotel_wizard diff --git a/hotel/wizard/hotel_wizard.py b/hotel/wizard/hotel_wizard.py index b461ccb..9ac7098 100644 --- a/hotel/wizard/hotel_wizard.py +++ b/hotel/wizard/hotel_wizard.py @@ -1,8 +1,9 @@ # -*- encoding: utf-8 -*- -############################################################################## +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,14 +19,14 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -################################################################################ +############################################################################# from openerp import models, fields, api class folio_report_wizard(models.TransientModel): _name = 'folio.report.wizard' _rec_name = 'date_start' - + date_start = fields.Datetime('Start Date') date_end = fields.Datetime('End Date') @@ -36,7 +37,8 @@ def print_report(self): 'model': 'hotel.folio', 'form': self.read(['date_start', 'date_end'])[0] } - return self.env['report'].get_action(self, 'hotel.report_hotel_folio', data=data) + return self.env['report'].get_action(self, 'hotel.report_hotel_folio', + data=data) class order_report_wizard(models.TransientModel): @@ -54,9 +56,8 @@ def print_pos_report(self): 'model': 'hotel.folio', 'form': self.read(['date_start', 'date_end', 'check'])[0] } - return self.env['report'].get_action(self, 'hotel.report_hotel_folio_pos', data=data) - + return self.env['report'].get_action(self, + 'hotel.report_hotel_folio_pos', + data=data) # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - - diff --git a/hotel_housekeeping/__init__.py b/hotel_housekeeping/__init__.py index 985dc28..76d374b 100644 --- a/hotel_housekeeping/__init__.py +++ b/hotel_housekeeping/__init__.py @@ -1,8 +1,9 @@ # -*- encoding: utf-8 -*- -############################################################################## +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,7 +19,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################# from . import models from . import wizard diff --git a/hotel_housekeeping/__openerp__.py b/hotel_housekeeping/__openerp__.py index 6a38905..7214790 100644 --- a/hotel_housekeeping/__openerp__.py +++ b/hotel_housekeeping/__openerp__.py @@ -1,8 +1,9 @@ -# -*- coding: utf-8 -*- -############################################################################## +# -*- encoding: utf-8 -*- +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,7 +19,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################# { "name": "Hotel Housekeeping Management", diff --git a/hotel_housekeeping/models/__init__.py b/hotel_housekeeping/models/__init__.py index af5eacc..03cfce2 100644 --- a/hotel_housekeeping/models/__init__.py +++ b/hotel_housekeeping/models/__init__.py @@ -1,8 +1,9 @@ # -*- encoding: utf-8 -*- -############################################################################## +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,6 +19,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################# from . import hotel_housekeeping + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/hotel_housekeeping/models/hotel_housekeeping.py b/hotel_housekeeping/models/hotel_housekeeping.py index 800008e..716b1fb 100644 --- a/hotel_housekeeping/models/hotel_housekeeping.py +++ b/hotel_housekeeping/models/hotel_housekeeping.py @@ -1,8 +1,9 @@ # -*- encoding: utf-8 -*- -############################################################################## +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,45 +19,69 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################ + from openerp.tools import ustr, DEFAULT_SERVER_DATE_FORMAT from openerp import models, fields, api, _, netsvc from openerp.exceptions import ValidationError import time + class product_category(models.Model): _inherit = "product.category" - isactivitytype = fields.Boolean('Is Activity Type', default=lambda *a: True) + isactivitytype = fields.Boolean('Is Activity Type', + default=lambda *a: True) + class hotel_housekeeping_activity_type(models.Model): _name = 'hotel.housekeeping.activity.type' _description = 'Activity Type' - activity_id = fields.Many2one('product.category', 'Category', required=True, delegate=True, ondelete='cascade') + activity_id = fields.Many2one('product.category', 'Category', + required=True, delegate=True, + ondelete='cascade') + class hotel_activity(models.Model): _name = 'hotel.activity' _description = 'Housekeeping Activity' - h_id = fields.Many2one('product.product', 'Product', required=True, delegate=True, ondelete='cascade') + h_id = fields.Many2one('product.product', 'Product', required=True, + delegate=True, ondelete='cascade') + class hotel_housekeeping(models.Model): _name = "hotel.housekeeping" _description = "Reservation" - current_date = fields.Date("Today's Date", required=True, default=lambda *a: time.strftime(DEFAULT_SERVER_DATE_FORMAT)) - clean_type = fields.Selection([('daily', 'Daily'), ('checkin', 'Check-In'), ('checkout', 'Check-Out')], 'Clean Type', required=True) + current_date = fields.Date("Today's Date", required=True, + default=(lambda *a: + time.strftime + (DEFAULT_SERVER_DATE_FORMAT))) + clean_type = fields.Selection([('daily', 'Daily'), + ('checkin', 'Check-In'), + ('checkout', 'Check-Out')], + 'Clean Type', required=True) room_no = fields.Many2one('hotel.room', 'Room No', required=True) - activity_lines = fields.One2many('hotel.housekeeping.activities', 'a_list', 'Activities', help='Details of housekeeping activities.') - inspector = fields.Many2one('res.users', 'Inspector' , required=True) + activity_lines = fields.One2many('hotel.housekeeping.activities', + 'a_list', 'Activities', + help='Detail of housekeeping activities') + inspector = fields.Many2one('res.users', 'Inspector', required=True) inspect_date_time = fields.Datetime('Inspect Date Time', required=True) - quality = fields.Selection([('bad', 'Bad'), ('good', 'Good'), ('ok', 'Ok')], 'Quality', required=True, help='Inspector inspect the room and mark as Bad, Good or Ok. ') - state = fields.Selection([('dirty', 'Dirty'), ('clean', 'Clean'), ('inspect', 'Inspect'), ('done', 'Done'), ('cancel', 'Cancelled')], 'State', select=True, required=True, readonly=True, default=lambda *a: 'dirty') + quality = fields.Selection([('bad', 'Bad'), ('good', 'Good'), + ('ok', 'Ok')], 'Quality', required=True, + help="Inspector inspect the room and mark \ +as Bad, Good or Ok. ") + state = fields.Selection([('dirty', 'Dirty'), ('clean', 'Clean'), + ('inspect', 'Inspect'), ('done', 'Done'), + ('cancel', 'Cancelled')], 'State', select=True, + required=True, readonly=True, + default=lambda *a: 'dirty') @api.multi def action_set_to_dirty(self): @@ -124,31 +149,39 @@ class hotel_housekeeping_activities(models.Model): a_list = fields.Many2one('hotel.housekeeping', string='Reservation') room_id = fields.Many2one('hotel.room', string='Room No') today_date = fields.Date('Today Date') - activity_name = fields.Many2one('hotel.activity', string='Housekeeping Activity') - housekeeper = fields.Many2one('res.users', string='Housekeeper' , required=True) - clean_start_time = fields.Datetime('Clean Start Time', required=True) + activity_name = fields.Many2one('hotel.activity', + string='Housekeeping Activity') + housekeeper = fields.Many2one('res.users', string='Housekeeper', + required=True) + clean_start_time = fields.Datetime('Clean Start Time', + required=True) clean_end_time = fields.Datetime('Clean End Time', required=True) - dirty = fields.Boolean('Dirty', help='Checked if the housekeeping activity results as Dirty.') - clean = fields.Boolean('Clean', help='Checked if the housekeeping activity results as Clean.') + dirty = fields.Boolean('Dirty', + help='Checked if the housekeeping activity \ +results as Dirty.') + clean = fields.Boolean('Clean', help='Checked if the housekeeping \ +activity results as Clean.') @api.constrains('clean_start_time', 'clean_end_time') def check_clean_start_time(self): ''' - This method is used to validate the clean_start_time and clean_end_time. - ------------------------------------------------------------------------ + This method is used to validate the clean_start_time and + clean_end_time. + --------------------------------------------------------- @param self : object pointer @return : raise warning depending on the validation ''' if self.clean_start_time >= self.clean_end_time: - raise ValidationError(_('Start Date Should be less than the End Date!')) + raise ValidationError(_('Start Date Should be \ + less than the End Date!')) @api.model def default_get(self, fields): """ To get default values for the object. @param self: The object pointer. - @param fields: List of fields for which we want default values - @return: A dictionary which of fields with values. + @param fields: List of fields for which we want default values + @return: A dictionary which of fields with values. """ if self._context is None: self._context = {} diff --git a/hotel_housekeeping/report/__init__.py b/hotel_housekeeping/report/__init__.py index 2fa7285..df109c6 100644 --- a/hotel_housekeeping/report/__init__.py +++ b/hotel_housekeeping/report/__init__.py @@ -1,8 +1,9 @@ -# -*- coding: utf-8 -*- -############################################################################## +# -*- encoding: utf-8 -*- +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,7 +19,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################ from . import housekeeping_report diff --git a/hotel_housekeeping/report/housekeeping_report.py b/hotel_housekeeping/report/housekeeping_report.py index e2327c7..07a1b7b 100644 --- a/hotel_housekeeping/report/housekeeping_report.py +++ b/hotel_housekeeping/report/housekeeping_report.py @@ -1,8 +1,9 @@ -# -*- coding: utf-8 -*- -############################################################################## +# -*- encoding: utf-8 -*- +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,7 +19,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################# import time from openerp import models @@ -26,6 +27,7 @@ from datetime import datetime from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT + class activity_report(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): @@ -40,21 +42,34 @@ def _get_room_activity_detail(self, date_start, date_end, room_data): activity_detail = [] house_keep_act_obj = self.pool.get('hotel.housekeeping.activities') if room_data: - activiti_line_ids = house_keep_act_obj.search(self.cr, self.uid, [('clean_start_time', '>=', date_start), ('clean_end_time', '<=', date_end)]) # ('room_id', '=', room_data[0]), - - for activity in house_keep_act_obj.browse(self.cr, self.uid, activiti_line_ids): + activiti_line_ids = (house_keep_act_obj.search + (self.cr, self.uid, + [('clean_start_time', '>=', date_start), + ('clean_end_time', '<=', date_end)])) + for activity in house_keep_act_obj.browse(self.cr, self.uid, + activiti_line_ids): act_val = {} - - ss_date = datetime.strptime(activity.clean_start_time, DEFAULT_SERVER_DATETIME_FORMAT) - ee_date = datetime.strptime(activity.clean_end_time, DEFAULT_SERVER_DATETIME_FORMAT) + ss_date = datetime.strptime(activity.clean_start_time, + DEFAULT_SERVER_DATETIME_FORMAT) + ee_date = datetime.strptime(activity.clean_end_time, + DEFAULT_SERVER_DATETIME_FORMAT) diff = ee_date - ss_date - act_val.update({'current_date':activity.today_date, 'activity':activity.activity_name and activity.activity_name.name or '', 'login':activity.housekeeper and activity.housekeeper.name or '', - 'clean_start_time':activity.clean_start_time, 'clean_end_time':activity.clean_end_time, 'duration':diff}) + act_val.update({'current_date':activity.today_date, + 'activity':(activity.activity_name and + activity.activity_name.name + or ''), + 'login':(activity.housekeeper and + activity.housekeeper.name or ''), + 'clean_start_time':activity.clean_start_time, + 'clean_end_time':activity.clean_end_time, + 'duration':diff}) activity_detail.append(act_val) return activity_detail - + def get_room_no(self, room_no): - return self.pool.get('hotel.room').browse(self.cr, self.uid, room_no).name + return self.pool.get('hotel.room').browse(self.cr, self.uid, + room_no).name + class report_lunchorder(models.AbstractModel): @@ -62,7 +77,7 @@ class report_lunchorder(models.AbstractModel): _inherit = 'report.abstract_report' _template = 'hotel_housekeeping.report_housekeeping' _wrapped_report_class = activity_report - + # report_sxw.report_sxw('report.activity.detail', 'hotel.housekeeping', 'addons/hotel_housekeeping/report/activity_detail.rml', parser=activity_report) # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/hotel_housekeeping/wizard/__init__.py b/hotel_housekeeping/wizard/__init__.py index 5e57c48..e5a850f 100644 --- a/hotel_housekeeping/wizard/__init__.py +++ b/hotel_housekeeping/wizard/__init__.py @@ -1,8 +1,9 @@ -# -*- coding: utf-8 -*- -############################################################################## +# -*- encoding: utf-8 -*- +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,7 +19,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################# from . import housekeeping_wizard diff --git a/hotel_housekeeping/wizard/housekeeping_wizard.py b/hotel_housekeeping/wizard/housekeeping_wizard.py index 539ce1a..e6110f9 100644 --- a/hotel_housekeeping/wizard/housekeeping_wizard.py +++ b/hotel_housekeeping/wizard/housekeeping_wizard.py @@ -1,8 +1,9 @@ -# -*- coding: utf-8 -*- -############################################################################## +# -*- encoding: utf-8 -*- +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,10 +19,11 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################# from openerp import models, fields, api + class hotel_housekeeping_wizard(models.TransientModel): _name = 'hotel.housekeeping.wizard' @@ -36,6 +38,9 @@ def print_report(self): 'model': 'hotel.housekeeping', 'form': self.read(['date_start', 'date_end', 'room_no'])[0] } - return self.env['report'].get_action(self, 'hotel_housekeeping.report_housekeeping', data=data) + return self.env['report' + ].get_action(self, + 'hotel_housekeeping.report_housekeeping', + data=data) # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/hotel_pos_restaurant/__init__.py b/hotel_pos_restaurant/__init__.py index e8e118f..2af5a53 100644 --- a/hotel_pos_restaurant/__init__.py +++ b/hotel_pos_restaurant/__init__.py @@ -1,8 +1,9 @@ -# -*- coding: utf-8 -*- -############################################################################## +# -*- encoding: utf-8 -*- +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,7 +19,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################# from . import models diff --git a/hotel_pos_restaurant/__openerp__.py b/hotel_pos_restaurant/__openerp__.py index 3c8392e..95d554d 100644 --- a/hotel_pos_restaurant/__openerp__.py +++ b/hotel_pos_restaurant/__openerp__.py @@ -1,8 +1,9 @@ -# -*- coding: utf-8 -*- -############################################################################## +# -*- encoding: utf-8 -*- +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,7 +19,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################# { "name": "Hotel POS Restaurant Management", diff --git a/hotel_pos_restaurant/models/__init__.py b/hotel_pos_restaurant/models/__init__.py index 91af159..301d246 100644 --- a/hotel_pos_restaurant/models/__init__.py +++ b/hotel_pos_restaurant/models/__init__.py @@ -1,8 +1,9 @@ -# -*- coding: utf-8 -*- -############################################################################## +# -*- encoding: utf-8 -*- +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,7 +19,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################# from . import pos_restaurant diff --git a/hotel_pos_restaurant/models/pos_restaurant.py b/hotel_pos_restaurant/models/pos_restaurant.py index 87f8b67..4dc07c1 100644 --- a/hotel_pos_restaurant/models/pos_restaurant.py +++ b/hotel_pos_restaurant/models/pos_restaurant.py @@ -1,8 +1,9 @@ -# -*- coding: utf-8 -*- -############################################################################## +# -*- encoding: utf-8 -*- +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -10,7 +11,6 @@ # 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 @@ -19,7 +19,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################# from openerp import models, fields, api from openerp.exceptions import ValidationError @@ -51,15 +51,15 @@ def get_folio_partner_id(self): @api.multi def action_paid(self): ''' - When pos order created this method called ,and sale order line + When pos order created this method called,and sale order line created for current folio -------------------------------------------------------------- @param self : object pointer ''' hotel_folio_obj = self.env['hotel.folio'] - hotel_service_line_obj = self.env['hotel.service.line'] + hsl_obj = self.env['hotel.service.line'] hotel_pos_order_obj = self.env['pos.order'] - sale_order_line_obj = self.env['sale.order.line'] + so_line_obj = self.env['sale.order.line'] for order_obj in self: hotelfolio = order_obj.folio_id.order_id.id if order_obj.folio_id: @@ -71,9 +71,12 @@ def action_paid(self): 'price_unit':order1.price_unit, 'price_subtotal':order1.price_subtotal, } - sale_order_line_rec = sale_order_line_obj.create(values) - hotel_service_line_obj.create({'folio_id':order_obj.folio_id.id, 'service_line_id':sale_order_line_rec.id}) - hotel_folio_rec = hotel_folio_obj.browse(order_obj.folio_id.id) - hotel_folio_rec.write({'folio_pos_order_ids': [(4, order_obj.id)]}) + sol_rec = so_line_obj.create(values) + hsl_obj.create({'folio_id': order_obj.folio_id.id, + 'service_line_id':sol_rec.id}) + hf_rec = hotel_folio_obj.browse(order_obj.folio_id.id) + hf_rec.write({'folio_pos_order_ids': + [(4, order_obj.id)]}) return super(pos_order, self).action_paid() +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/hotel_reservation/__init__.py b/hotel_reservation/__init__.py index 7ae70bd..76d374b 100644 --- a/hotel_reservation/__init__.py +++ b/hotel_reservation/__init__.py @@ -1,8 +1,9 @@ # -*- encoding: utf-8 -*- -############################################################################## +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,11 +19,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################# from . import models from . import wizard from . import report - # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/hotel_reservation/__openerp__.py b/hotel_reservation/__openerp__.py index a7c5be1..f6d7cca 100644 --- a/hotel_reservation/__openerp__.py +++ b/hotel_reservation/__openerp__.py @@ -1,8 +1,9 @@ -# -*- coding: utf-8 -*- -############################################################################## +# -*- encoding: utf-8 -*- +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,13 +19,13 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################# { - "name" : "Hotel Reservation Management", - "version" : "0.07", + "name": "Hotel Reservation Management", + "version": "0.07", "author": ["Serpent Consulting Services Pvt. Ltd.", "OpenERP SA" ], - "category" : "Generic Modules/Hotel Reservation", + "category": "Generic Modules/Hotel Reservation", "description": """ Module for Hotel/Resort/Property management. You can manage: * Guest Reservation @@ -32,10 +33,11 @@ Different reports are also provided, mainly for hotel statistics. """, "website": ["http://www.serpentcs.com", "http://www.openerp.com"], - "depends" : ["hotel", "stock", "report_extended", 'mail', 'email_template', ], + "depends": ["hotel", "stock", "report_extended", + 'mail', 'email_template', ], "demo": ["views/hotel_reservation_data.xml"], - "data" : [ + "data": [ "security/ir.model.access.csv", "wizard/hotel_reservation_wizard.xml", "report/hotel_reservation_report.xml", diff --git a/hotel_reservation/models/__init__.py b/hotel_reservation/models/__init__.py index 231aa01..bf2798c 100644 --- a/hotel_reservation/models/__init__.py +++ b/hotel_reservation/models/__init__.py @@ -1,8 +1,9 @@ # -*- encoding: utf-8 -*- -############################################################################## +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,6 +19,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################# from . import hotel_reservation + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/hotel_reservation/models/hotel_reservation.py b/hotel_reservation/models/hotel_reservation.py index 9b7d5c4..c1ddbda 100644 --- a/hotel_reservation/models/hotel_reservation.py +++ b/hotel_reservation/models/hotel_reservation.py @@ -1,8 +1,9 @@ # -*- encoding: utf-8 -*- -############################################################################## +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,7 +19,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################# + from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT from openerp.exceptions import except_orm, ValidationError from dateutil.relativedelta import relativedelta @@ -31,7 +33,9 @@ class hotel_folio(models.Model): _inherit = 'hotel.folio' _order = 'reservation_id desc' - reservation_id = fields.Many2one(comodel_name='hotel.reservation', string='Reservation Id') + reservation_id = fields.Many2one(comodel_name='hotel.reservation', + string='Reservation Id') + class hotel_reservation(models.Model): @@ -42,20 +46,61 @@ class hotel_reservation(models.Model): _inherit = ['mail.thread', 'ir.needaction_mixin'] reservation_no = fields.Char('Reservation No', size=64, readonly=True) - date_order = fields.Datetime('Date Ordered', required=True, readonly=True, states={'draft':[('readonly', False)]}, default=lambda *a: time.strftime(DEFAULT_SERVER_DATETIME_FORMAT)) - warehouse_id = fields.Many2one('stock.warehouse', 'Hotel', readonly=True, required=True, default=1, states={'draft':[('readonly', False)]}) - partner_id = fields.Many2one('res.partner', 'Guest Name' , readonly=True, required=True, states={'draft':[('readonly', False)]}) - pricelist_id = fields.Many2one('product.pricelist', 'Scheme' , required=True, readonly=True, states={'draft':[('readonly', False)]}, help="Pricelist for current reservation. ") - partner_invoice_id = fields.Many2one('res.partner', 'Invoice Address' , readonly=True, states={'draft':[('readonly', False)]}, help="Invoice address for current reservation. ") - partner_order_id = fields.Many2one('res.partner', 'Ordering Contact', readonly=True, states={'draft':[('readonly', False)]}, help="The name and address of the contact that requested the order or quotation.") - partner_shipping_id = fields.Many2one('res.partner', 'Delivery Address' , readonly=True, states={'draft':[('readonly', False)]}, help="Delivery address for current reservation. ") - checkin = fields.Datetime('Expected-Date-Arrival', required=True, readonly=True, states={'draft':[('readonly', False)]}) - checkout = fields.Datetime('Expected-Date-Departure', required=True, readonly=True, states={'draft':[('readonly', False)]}) - adults = fields.Integer('Adults', size=64, readonly=True, states={'draft':[('readonly', False)]}, help='List of adults there in guest list. ') - children = fields.Integer('Children', size=64, readonly=True, states={'draft':[('readonly', False)]}, help='Number of children there in guest list. ') - reservation_line = fields.One2many('hotel_reservation.line', 'line_id', 'Reservation Line', help='Hotel room reservation details.') - state = fields.Selection([('draft', 'Draft'), ('confirm', 'Confirm'), ('cancel', 'Cancel'), ('done', 'Done')], 'State', readonly=True, default=lambda *a: 'draft') - folio_id = fields.Many2many('hotel.folio', 'hotel_folio_reservation_rel', 'order_id', 'invoice_id', string='Folio') + date_order = fields.Datetime('Date Ordered', required=True, readonly=True, + states={'draft':[('readonly', False)]}, + default=(lambda *a: + time.strftime + (DEFAULT_SERVER_DATETIME_FORMAT))) + warehouse_id = fields.Many2one('stock.warehouse', 'Hotel', readonly=True, + required=True, default=1, + states={'draft':[('readonly', False)]}) + partner_id = fields.Many2one('res.partner', 'Guest Name', readonly=True, + required=True, + states={'draft':[('readonly', False)]}) + pricelist_id = fields.Many2one('product.pricelist', 'Scheme', + required=True, readonly=True, + states={'draft':[('readonly', False)]}, + help="Pricelist for current reservation.") + partner_invoice_id = fields.Many2one('res.partner', 'Invoice Address', + readonly=True, + states={'draft': + [('readonly', False)]}, + help="Invoice address for " \ + "current reservation.") + partner_order_id = fields.Many2one('res.partner', 'Ordering Contact', + readonly=True, + states={'draft': + [('readonly', False)]}, + help="The name and address of the " \ + "contact that requested the order " \ + "or quotation.") + partner_shipping_id = fields.Many2one('res.partner', 'Delivery Address', + readonly=True, + states={'draft': + [('readonly', False)]}, + help="Delivery address" \ + "for current reservation. ") + checkin = fields.Datetime('Expected-Date-Arrival', required=True, + readonly=True, + states={'draft':[('readonly', False)]}) + checkout = fields.Datetime('Expected-Date-Departure', required=True, + readonly=True, + states={'draft':[('readonly', False)]}) + adults = fields.Integer('Adults', size=64, readonly=True, + states={'draft':[('readonly', False)]}, + help='List of adults there in guest list. ') + children = fields.Integer('Children', size=64, readonly=True, + states={'draft':[('readonly', False)]}, + help='Number of children there in guest list.') + reservation_line = fields.One2many('hotel_reservation.line', 'line_id', + 'Reservation Line', + help='Hotel room reservation details.') + state = fields.Selection([('draft', 'Draft'), ('confirm', 'Confirm'), + ('cancel', 'Cancel'), ('done', 'Done')], + 'State', readonly=True, + default=lambda *a: 'draft') + folio_id = fields.Many2many('hotel.folio', 'hotel_folio_reservation_rel', + 'order_id', 'invoice_id', string='Folio') dummy = fields.Datetime('Dummy') @api.constrains('reservation_line', 'adults', 'children') @@ -68,15 +113,19 @@ def check_reservation_rooms(self): ''' for reservation in self: if len(reservation.reservation_line) == 0: - raise ValidationError(_('Please Select Rooms For Reservation.')) + raise ValidationError(_('Please Select Rooms \ + For Reservation.')) for rec in reservation.reservation_line: if len(rec.reserve) == 0: - raise ValidationError(_('Please Select Rooms For Reservation.')) + raise ValidationError(_('Please Select Rooms \ + For Reservation.')) cap = 0 for room in rec.reserve: cap += room.capacity if (self.adults + self.children) > cap : - raise ValidationError(_('Room Capacity Exceeded \n Please Select Rooms According to Members Accomodation.')) + raise ValidationError(_('Room Capacity \ + Exceeded \n Please Select Rooms According to \ + Members Accomodation.')) @api.model def _needaction_count(self, domain=None): @@ -90,14 +139,15 @@ def on_change_checkin(self): ''' When you change date_order or checkin it will check whether Checkin date should be greater than the current date - ------------------------------------------------------------- + ------------------------------------------------------------ @param self : object pointer @return : raise warning depending on the validation ''' checkin_date = time.strftime(DEFAULT_SERVER_DATETIME_FORMAT) if self.date_order and self.checkin: if self.checkin < self.date_order: - raise except_orm(_('Warning'), _('Checkin date should be greater than the current date.')) + raise except_orm(_('Warning'), _('Checkin date should be \ + greater than the current date.')) @api.onchange('checkout', 'checkin') def on_change_checkout(self): @@ -105,7 +155,7 @@ def on_change_checkout(self): When you change checkout or checkin it will check whether Checkout date should be greater than Checkin date and update dummy field - ------------------------------------------------------------- + ----------------------------------------------------------- @param self : object pointer @return : raise warning depending on the validation ''' @@ -116,9 +166,11 @@ def on_change_checkout(self): return {'value':{}} if self.checkout and self.checkin: if self.checkout < self.checkin: - raise except_orm(_('Warning'), _('Checkout date should be greater than Checkin date.')) + raise except_orm(_('Warning'), _('Checkout date \ + should be greater than Checkin date.')) delta = datetime.timedelta(days=1) - addDays = datetime.datetime(*time.strptime(checkout_date, DEFAULT_SERVER_DATETIME_FORMAT)[:5]) + delta + dat_a = time.strptime(checkout_date, DEFAULT_SERVER_DATETIME_FORMAT)[:5] + addDays = datetime.datetime(*dat_a) + delta self.dummy = addDays.strftime(DEFAULT_SERVER_DATETIME_FORMAT) @api.onchange('partner_id') @@ -126,7 +178,7 @@ def onchange_partner_id(self): ''' When you change partner_id it will update the partner_invoice_id, partner_shipping_id and pricelist_id of the hotel reservation as well - ---------------------------------------------------------------------- + --------------------------------------------------------------------- @param self : object pointer ''' if not self.partner_id: @@ -135,7 +187,8 @@ def onchange_partner_id(self): self.partner_order_id = False else: partner_lst = [self.partner_id.id] - addr = self.partner_id.address_get(['delivery', 'invoice', 'contact']) + addr = self.partner_id.address_get(['delivery', 'invoice', + 'contact']) self.partner_invoice_id = addr['invoice'] self.partner_order_id = addr['contact'] self.partner_shipping_id = addr['delivery'] @@ -145,28 +198,37 @@ def onchange_partner_id(self): def confirmed_reservation(self): """ This method create a new recordset for hotel room reservation line - ------------------------------------------------------------------- + ------------------------------------------------------------------ @param self: The object pointer @return: new record set for hotel room reservation line. """ reservation_line_obj = self.env['hotel.room.reservation.line'] for reservation in self: self._cr.execute("select count(*) from hotel_reservation as hr " \ - "inner join hotel_reservation_line as hrl on hrl.line_id = hr.id " \ - "inner join hotel_reservation_line_room_rel as hrlrr on hrlrr.room_id = hrl.id " \ - "where (checkin,checkout) overlaps ( timestamp %s , timestamp %s ) " \ + "inner join hotel_reservation_line as hrl on \ + hrl.line_id = hr.id " \ + "inner join hotel_reservation_line_room_rel as \ + hrlrr on hrlrr.room_id = hrl.id " \ + "where (checkin,checkout) overlaps \ + ( timestamp %s, timestamp %s ) " \ "and hr.id <> cast(%s as integer) " \ "and hr.state = 'confirm' " \ "and hrlrr.hotel_reservation_line_id in (" \ - "select hrlrr.hotel_reservation_line_id from hotel_reservation as hr " \ - "inner join hotel_reservation_line as hrl on hrl.line_id = hr.id " \ - "inner join hotel_reservation_line_room_rel as hrlrr on hrlrr.room_id = hrl.id " \ + "select hrlrr.hotel_reservation_line_id \ + from hotel_reservation as hr " \ + "inner join hotel_reservation_line as \ + hrl on hrl.line_id = hr.id " \ + "inner join hotel_reservation_line_room_rel \ + as hrlrr on hrlrr.room_id = hrl.id " \ "where hr.id = cast(%s as integer) )" \ - , (reservation.checkin, reservation.checkout, str(reservation.id), str(reservation.id))) + , (reservation.checkin, reservation.checkout, + str(reservation.id), str(reservation.id))) res = self._cr.fetchone() roomcount = res and res[0] or 0.0 if roomcount: - raise except_orm(_('Warning'), _('You tried to confirm reservation with room those already reserved in this reservation period')) + raise except_orm(_('Warning'), _('You tried to confirm \ + reservation with room those already reserved in this \ + reservation period')) else: self.write({'state':'confirm'}) for line_id in reservation.reservation_line: @@ -186,17 +248,22 @@ def confirmed_reservation(self): @api.multi def send_reservation_maill(self): ''' - This function opens a window to compose an email, template message loaded by default. + This function opens a window to compose an email, + template message loaded by default. @param self : object pointer ''' - assert len(self._ids) == 1, 'This option should only be used for a single id at a time.' + assert len(self._ids) == 1, 'This is for a single id at a time.' ir_model_data = self.env['ir.model.data'] try: - template_id = ir_model_data.get_object_reference('hotel_reservation', 'email_template_hotel_reservation')[1] + template_id = (ir_model_data.get_object_reference + ('hotel_reservation', + 'email_template_hotel_reservation')[1]) except ValueError: template_id = False try: - compose_form_id = ir_model_data.get_object_reference('mail', 'email_compose_message_wizard_form')[1] + compose_form_id = (ir_model_data.get_object_reference + ('mail', + 'email_compose_message_wizard_form')[1]) except ValueError: compose_form_id = False ctx = dict() @@ -225,20 +292,27 @@ def send_reservation_maill(self): def reservation_reminder_24hrs(self): """ This method is for scheduler - every 1day scheduler will call this method to find all tomorrow's reservations. - -------------------------------------------------------------------------------------------- + every 1day scheduler will call this method to + find all tomorrow's reservations. + ---------------------------------------------- @param self: The object pointer @return: send a mail """ now_str = time.strftime(DEFAULT_SERVER_DATETIME_FORMAT) - now_date = datetime.datetime.strptime(now_str, DEFAULT_SERVER_DATETIME_FORMAT) + now_date = datetime.datetime.strptime(now_str, + DEFAULT_SERVER_DATETIME_FORMAT) ir_model_data = self.env['ir.model.data'] - template_id = ir_model_data.get_object_reference('hotel_reservation', 'email_template_reservation_reminder_24hrs')[1] + template_id = (ir_model_data.get_object_reference + ('hotel_reservation', + 'email_template_reservation_reminder_24hrs')[1]) template_rec = self.env['email.template'].browse(template_id) for travel_rec in self.search([]): - checkin_date = datetime.datetime.strptime(travel_rec.checkin, DEFAULT_SERVER_DATETIME_FORMAT) + checkin_date = (datetime.datetime.strptime + (travel_rec.checkin, + DEFAULT_SERVER_DATETIME_FORMAT)) difference = relativedelta(now_date, checkin_date) - if difference.days == -1 and travel_rec.partner_id.email and travel_rec.state == 'confirm': + if(difference.days == -1 and travel_rec.partner_id.email and + travel_rec.state == 'confirm'): template_rec.send_mail(travel_rec.id, force_send=True) return True @@ -255,10 +329,15 @@ def _create_folio(self): room_obj = self.env['hotel.room'] for reservation in self: folio_lines = [] - checkin_date, checkout_date = reservation['checkin'], reservation['checkout'] + checkin_date = reservation['checkin'] + checkout_date = reservation['checkout'] if not self.checkin < self.checkout: - raise except_orm(_('Error'), _('Invalid values in reservation.\nCheckout date should be greater than the Checkin date.')) - duration_vals = self.onchange_check_dates(checkin_date=checkin_date, checkout_date=checkout_date, duration=False) + raise except_orm(_('Error'), + _('Checkout date should be greater \ + than the Checkin date.')) + duration_vals = (self.onchange_check_dates + (checkin_date=checkin_date, + checkout_date=checkout_date, duration=False)) duration = duration_vals.get('duration') or 0.0 folio_vals = { 'date_order':reservation.date_order, @@ -273,6 +352,12 @@ def _create_folio(self): 'reservation_id': reservation.id, 'service_lines':reservation['folio_id'] } + date_a = (datetime.datetime + (*time.strptime(reservation['checkout'], + DEFAULT_SERVER_DATETIME_FORMAT)[:5])) + date_b = (datetime.datetime + (*time.strptime(reservation['checkin'], + DEFAULT_SERVER_DATETIME_FORMAT)[:5])) for line in reservation.reservation_line: for r in line.reserve: folio_lines.append((0, 0, { @@ -282,23 +367,28 @@ def _create_folio(self): 'name': reservation['reservation_no'], 'product_uom': r['uom_id'].id, 'price_unit': r['lst_price'], - 'product_uom_qty': ((datetime.datetime(*time.strptime(reservation['checkout'], DEFAULT_SERVER_DATETIME_FORMAT)[:5]) - datetime.datetime(*time.strptime(reservation['checkin'], DEFAULT_SERVER_DATETIME_FORMAT)[:5])).days) + 1 + 'product_uom_qty': ((date_a - date_b).days) + 1 })) res_obj = room_obj.browse([r.id]) res_obj.write({'status': 'occupied', 'isroom':False}) folio_vals.update({'room_lines': folio_lines}) folio = hotel_folio_obj.create(folio_vals) - self._cr.execute('insert into hotel_folio_reservation_rel (order_id, invoice_id) values (%s,%s)', (reservation.id, folio.id)) + self._cr.execute('insert into hotel_folio_reservation_rel \ + (order_id, invoice_id) values (%s,%s)', + (reservation.id, folio.id)) reservation.write({'state': 'done'}) return True @api.multi - def onchange_check_dates(self, checkin_date=False, checkout_date=False, duration=False): + def onchange_check_dates(self, checkin_date=False, checkout_date=False, + duration=False): ''' - This mathod gives the duration between check in checkout if customer will leave only for some - hour it would be considers as a whole day. If customer will checkin checkout for more or equal - hours , which configured in company as additional hours than it would be consider as full days - --------------------------------------------------------------------------------------------- + This mathod gives the duration between check in checkout if + customer will leave only for some hour it would be considers + as a whole day. If customer will checkin checkout for more or equal + hours, which configured in company as additional hours than it would + be consider as full days + -------------------------------------------------------------------- @param self : object pointer @return : Duration and checkout_date ''' @@ -310,8 +400,10 @@ def onchange_check_dates(self, checkin_date=False, checkout_date=False, duration configured_addition_hours = company_ids[0].additional_hours duration = 0 if checkin_date and checkout_date: - chkin_dt = datetime.datetime.strptime(checkin_date, DEFAULT_SERVER_DATETIME_FORMAT) - chkout_dt = datetime.datetime.strptime(checkout_date, DEFAULT_SERVER_DATETIME_FORMAT) + chkin_dt = (datetime.datetime.strptime + (checkin_date, DEFAULT_SERVER_DATETIME_FORMAT)) + chkout_dt = (datetime.datetime.strptime + (checkout_date, DEFAULT_SERVER_DATETIME_FORMAT)) dur = chkout_dt - chkin_dt duration = dur.days + 1 if configured_addition_hours > 0: @@ -332,7 +424,8 @@ def create(self, vals): vals = {} if self._context is None: self._context = {} - vals['reservation_no'] = self.env['ir.sequence'].get('hotel.reservation') + vals['reservation_no'] = self.env['ir.sequence' + ].get('hotel.reservation') return super(hotel_reservation, self).create(vals) @@ -343,27 +436,41 @@ class hotel_reservation_line(models.Model): name = fields.Char('Name', size=64) line_id = fields.Many2one('hotel.reservation') - reserve = fields.Many2many('hotel.room', 'hotel_reservation_line_room_rel', 'room_id', 'hotel_reservation_line_id', domain="[('isroom','=',True),('categ_id','=',categ_id)]") - categ_id = fields.Many2one('product.category', 'Room Type' , domain="[('isroomtype','=',True)]", change_default=True) + reserve = fields.Many2many('hotel.room', + 'hotel_reservation_line_room_rel', + 'room_id', 'hotel_reservation_line_id', + domain="[('isroom','=',True),\ + ('categ_id','=',categ_id)]") + categ_id = fields.Many2one('product.category', 'Room Type', + domain="[('isroomtype','=',True)]", + change_default=True) @api.onchange('categ_id') def on_change_categ(self): ''' - When you change categ_id it check checkin and checkout are filled or not - if not then raise warning - ------------------------------------------------------------------------ + When you change categ_id it check checkin and checkout are + filled or not if not then raise warning + ----------------------------------------------------------- @param self : object pointer ''' hotel_room_obj = self.env['hotel.room'] - hotel_room_ids = hotel_room_obj.search([('categ_id', '=', self.categ_id.id), ('isroom', '=', True)]) + hotel_room_ids = hotel_room_obj.search([('categ_id', '=', + self.categ_id.id), + ('isroom', '=', True)]) assigned = False room_ids = [] if not self.line_id.checkin: - raise except_orm(_('Warning'), _('Before choosing a room,\n You have to select a Check in date or a Check out date in the reservation form.')) + raise except_orm(_('Warning'), + _('Before choosing a room,\n You have to select \ + a Check in date or a Check out date in \ + the reservation form.')) for room in hotel_room_ids: assigned = False for line in room.room_reservation_line_ids: - if line.check_in >= self.line_id.checkin and line.check_in <= self.line_id.checkout or line.check_out <= self.line_id.checkout and line.check_out >= self.line_id.checkin: + if(line.check_in >= self.line_id.checkin and + line.check_in <= self.line_id.checkout or + line.check_out <= self.line_id.checkout and + line.check_out >= self.line_id.checkin): assigned = True if not assigned: room_ids.append(room.id) @@ -377,10 +484,12 @@ def unlink(self): @param self: The object pointer @return: True/False. """ - hotel_room_reservation_line_obj = self.env['hotel.room.reservation.line'] + hotel_room_reserv_line_obj = self.env['hotel.room.reservation.line'] for reserv_rec in self: for rec in reserv_rec.reserve: - myobj = hotel_room_reservation_line_obj.search([('room_id', '=', rec.id), ('reservation_id', '=', reserv_rec.line_id.id)]) + hres_arg = [('room_id', '=',rec.id), + ('reservation_id', '=', reserv_rec.line_id.id)] + myobj = hotel_room_reserv_line_obj.search(hres_arg) if myobj.ids: rec.write({'isroom':True, 'status':'available'}) myobj.unlink() @@ -395,8 +504,10 @@ class hotel_room_reservation_line(models.Model): room_id = fields.Many2one(comodel_name='hotel.room', string='Room id') check_in = fields.Datetime('Check In Date', required=True) check_out = fields.Datetime('Check Out Date', required=True) - state = fields.Selection([('assigned', 'Assigned'), ('unassigned', 'Unassigned')], 'Room Status') - reservation_id = fields.Many2one('hotel.reservation', string='Reservation') + state = fields.Selection([('assigned', 'Assigned'), + ('unassigned', 'Unassigned')], 'Room Status') + reservation_id = fields.Many2one('hotel.reservation', + string='Reservation') status = fields.Selection(string='state', related='reservation_id.state') hotel_room_reservation_line() @@ -407,14 +518,17 @@ class hotel_room(models.Model): _inherit = 'hotel.room' _description = 'Hotel Room' - room_reservation_line_ids = fields.One2many('hotel.room.reservation.line', 'room_id', string='Room Reservation Line') + room_reservation_line_ids = fields.One2many('hotel.room.reservation.line', + 'room_id', + string='Room Reserv Line') @api.model def cron_room_line(self): """ This method is for scheduler - every 1min scheduler will call this method and check Status of room is occupied or available - -------------------------------------------------------------------------------------------- + every 1min scheduler will call this method and check Status of + room is occupied or available + -------------------------------------------------------------- @param self: The object pointer @return: update status of hotel room reservation line """ @@ -423,10 +537,18 @@ def cron_room_line(self): now = datetime.datetime.now() curr_date = now.strftime(DEFAULT_SERVER_DATETIME_FORMAT) for room in self.search([]): - reserv_line_ids = [reservation_line.ids for reservation_line in room.room_reservation_line_ids] - reservation_line_ids = reservation_line_obj.search([('id', 'in', reserv_line_ids), ('check_in', '<=', curr_date), ('check_out', '>=', curr_date)]) + reserv_line_ids = [reservation_line.ids for + reservation_line in + room.room_reservation_line_ids] + reserv_args = [('id', 'in', reserv_line_ids), + ('check_in', '<=', curr_date), + ('check_out', '>=', curr_date)] + reservation_line_ids = reservation_line_obj.search(reserv_args) rooms_ids = [room_line.ids for room_line in room.room_line_ids] - room_line_ids = folio_room_line_obj.search([('id', 'in', rooms_ids), ('check_in', '<=', curr_date), ('check_out', '>=', curr_date)]) + rom_args = [('id', 'in', rooms_ids), + ('check_in', '<=', curr_date), + ('check_out', '>=', curr_date)] + room_line_ids = folio_room_line_obj.search(rom_args) status = {'isroom':True, 'color':5} if reservation_line_ids.ids: status = {'isroom':False, 'color':2} @@ -435,7 +557,9 @@ def cron_room_line(self): status = {'isroom':False, 'color':2} room.write(status) if reservation_line_ids.ids and room_line_ids.ids: - raise except_orm(_('Wrong Entry'), _('Please Check Rooms Status for %s.' % (room.name))) + raise except_orm(_('Wrong Entry'), + _('Please Check Rooms Status \ + for %s.' % (room.name))) return True class room_reservation_summary(models.Model): @@ -461,13 +585,16 @@ def default_get(self, fields): res = super(room_reservation_summary, self).default_get(fields) if self.date_from == False and self.date_to == False: date_today = datetime.datetime.today() - first_day = datetime.datetime(date_today.year, date_today.month, 1, 0, 0, 0) + first_day = datetime.datetime(date_today.year, + date_today.month, 1, 0, 0, 0) first_temp_day = first_day + relativedelta(months=1) last_temp_day = first_temp_day - relativedelta(days=1) - last_day = datetime.datetime(last_temp_day.year, last_temp_day.month, last_temp_day.day, 23, 59, 59) + last_day = datetime.datetime(last_temp_day.year, + last_temp_day.month, + last_temp_day.day, 23, 59, 59) date_froms = first_day.strftime(DEFAULT_SERVER_DATETIME_FORMAT) date_ends = last_day.strftime(DEFAULT_SERVER_DATETIME_FORMAT) - res.update({'date_from': date_froms , 'date_to':date_ends}) + res.update({'date_from': date_froms, 'date_to':date_ends}) return res @api.multi @@ -478,7 +605,9 @@ def room_reservation(self): mod_obj = self.env['ir.model.data'] if self._context is None: self._context = {} - model_data_ids = mod_obj.search([('model', '=', 'ir.ui.view'), ('name', '=', 'view_hotel_reservation_form')]) + model_data_ids = mod_obj.search([('model', '=', 'ir.ui.view'), + ('name', '=', + 'view_hotel_reservation_form')]) resource_id = model_data_ids.read(fields=['res_id'])[0]['res_id'] return { 'name': _('Reconcile Write-Off'), @@ -505,15 +634,22 @@ def get_room_summary(self): summary_header_list = ['Rooms'] if self.date_from and self.date_to: if self.date_from > self.date_to: - raise except_orm(_('User Error!'), _('Please Check Time period Date From can\'t be greater than Date To !')) - d_frm_obj = datetime.datetime.strptime(self.date_from, DEFAULT_SERVER_DATETIME_FORMAT) - d_to_obj = datetime.datetime.strptime(self.date_to, DEFAULT_SERVER_DATETIME_FORMAT) + raise except_orm(_('User Error!'), + _('Please Check Time period Date \ + From can\'t be greater than Date To !')) + d_frm_obj = (datetime.datetime.strptime + (self.date_from, DEFAULT_SERVER_DATETIME_FORMAT)) + d_to_obj = (datetime.datetime.strptime + (self.date_to, DEFAULT_SERVER_DATETIME_FORMAT)) temp_date = d_frm_obj while(temp_date <= d_to_obj): val = '' - val = str(temp_date.strftime("%a")) + ' ' + str(temp_date.strftime("%b")) + ' ' + str(temp_date.strftime("%d")) + val = (str(temp_date.strftime("%a")) + ' ' + + str(temp_date.strftime("%b")) + ' ' + + str(temp_date.strftime("%d"))) summary_header_list.append(val) - date_range_list.append(temp_date.strftime(DEFAULT_SERVER_DATETIME_FORMAT)) + date_range_list.append(temp_date.strftime + (DEFAULT_SERVER_DATETIME_FORMAT)) temp_date = temp_date + datetime.timedelta(days=1) all_detail.append(summary_header_list) room_ids = room_obj.search([]) @@ -524,17 +660,27 @@ def get_room_summary(self): room_detail.update({'name':room.name or ''}) if not room.room_reservation_line_ids: for chk_date in date_range_list: - room_list_stats.append({'state':'Free', 'date':chk_date}) + room_list_stats.append({'state':'Free', + 'date':chk_date}) else: for chk_date in date_range_list: for room_res_line in room.room_reservation_line_ids: - reservation_line_ids = [i.ids for i in room.room_reservation_line_ids] - reservation_line_ids = reservation_line_obj.search([('id', 'in', reservation_line_ids), ('check_in', '<=', chk_date), ('check_out', '>=', chk_date)]) - if reservation_line_ids: - room_list_stats.append({'state':'Reserved', 'date':chk_date, 'room_id':room.id}) + reservline_ids = [i.ids for i in + room.room_reservation_line_ids] + reservline_ids = (reservation_line_obj.search + ([('id', 'in', reservline_ids), + ('check_in', '<=', chk_date), + ('check_out', '>=', chk_date) + ])) + if reservline_ids: + room_list_stats.append({'state':'Reserved', + 'date':chk_date, + 'room_id':room.id}) break else: - room_list_stats.append({'state':'Free', 'date':chk_date, 'room_id':room.id}) + room_list_stats.append({'state':'Free', + 'date':chk_date, + 'room_id':room.id}) break room_detail.update({'value':room_list_stats}) all_room_detail.append(room_detail) @@ -547,15 +693,20 @@ class quick_room_reservation(models.TransientModel): _name = 'quick.room.reservation' _description = 'Quick Room Reservation' - partner_id = fields.Many2one('res.partner', string="Customer", required=True) + partner_id = fields.Many2one('res.partner', string="Customer", + required=True) check_in = fields.Datetime('Check In', required=True) check_out = fields.Datetime('Check Out', required=True) room_id = fields.Many2one('hotel.room', 'Room', required=True) warehouse_id = fields.Many2one('stock.warehouse', 'Hotel', required=True) - pricelist_id = fields.Many2one('product.pricelist', 'pricelist', required=True) - partner_invoice_id = fields.Many2one('res.partner', 'Invoice Address' , required=True) - partner_order_id = fields.Many2one('res.partner', 'Ordering Contact', required=True) - partner_shipping_id = fields.Many2one('res.partner', 'Delivery Address' , required=True) + pricelist_id = fields.Many2one('product.pricelist', 'pricelist', + required=True) + partner_invoice_id = fields.Many2one('res.partner', 'Invoice Address', + required=True) + partner_order_id = fields.Many2one('res.partner', 'Ordering Contact', + required=True) + partner_shipping_id = fields.Many2one('res.partner', 'Delivery Address', + required=True) @api.onchange('check_out', 'check_in') def on_change_check_out(self): @@ -563,20 +714,22 @@ def on_change_check_out(self): When you change checkout or checkin it will check whether Checkout date should be greater than Checkin date and update dummy field - ------------------------------------------------------------- + ----------------------------------------------------------- @param self : object pointer @return : raise warning depending on the validation ''' if self.check_out and self.check_in: if self.check_out < self.check_in: - raise except_orm(_('Warning'), _('Checkout date should be greater than Checkin date.')) + raise except_orm(_('Warning'), + _('Checkout date should be greater \ + than Checkin date.')) @api.onchange('partner_id') def onchange_partner_id_res(self): ''' When you change partner_id it will update the partner_invoice_id, partner_shipping_id and pricelist_id of the hotel reservation as well - ---------------------------------------------------------------------- + --------------------------------------------------------------------- @param self : object pointer ''' if not self.partner_id: @@ -584,7 +737,8 @@ def onchange_partner_id_res(self): self.partner_shipping_id = False self.partner_order_id = False else: - addr = self.partner_id.address_get(['delivery', 'invoice', 'contact']) + addr = self.partner_id.address_get(['delivery', 'invoice', + 'contact']) self.partner_invoice_id = addr['invoice'] self.partner_order_id = addr['contact'] self.partner_shipping_id = addr['delivery'] @@ -595,7 +749,7 @@ def default_get(self, fields): """ To get default values for the object. @param self: The object pointer. - @param fields: List of fields for which we want default values + @param fields: List of fields for which we want default values @return: A dictionary which of fields with values. """ if self._context is None: @@ -619,19 +773,19 @@ def room_reserve(self): @return: new record set for hotel reservation. """ hotel_res_obj = self.env['hotel.reservation'] - for room_resv in self: + for res in self: hotel_res_obj.create({ - 'partner_id':room_resv.partner_id.id, - 'partner_invoice_id':room_resv.partner_invoice_id.id, - 'partner_order_id':room_resv.partner_order_id.id, - 'partner_shipping_id':room_resv.partner_shipping_id.id, - 'checkin':room_resv.check_in, - 'checkout':room_resv.check_out, - 'warehouse_id':room_resv.warehouse_id.id, - 'pricelist_id':room_resv.pricelist_id.id, + 'partner_id':res.partner_id.id, + 'partner_invoice_id':res.partner_invoice_id.id, + 'partner_order_id':res.partner_order_id.id, + 'partner_shipping_id':res.partner_shipping_id.id, + 'checkin':res.check_in, + 'checkout':res.check_out, + 'warehouse_id':res.warehouse_id.id, + 'pricelist_id':res.pricelist_id.id, 'reservation_line':[(0, 0, { - 'reserve': [(6, 0, [room_resv.room_id.id])], - 'name':room_resv.room_id and room_resv.room_id.name or ''})] + 'reserve': [(6, 0, [res.room_id.id])], + 'name':res.room_id and res.room_id.name or ''})] }) return True diff --git a/hotel_reservation/report/__init__.py b/hotel_reservation/report/__init__.py index 72bc580..4a4b2d6 100644 --- a/hotel_reservation/report/__init__.py +++ b/hotel_reservation/report/__init__.py @@ -1,8 +1,9 @@ # -*- encoding: utf-8 -*- -############################################################################## +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,7 +19,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################# from . import hotel_reservation_report # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/hotel_reservation/report/hotel_reservation_report.py b/hotel_reservation/report/hotel_reservation_report.py index a213b1d..2d33c4e 100644 --- a/hotel_reservation/report/hotel_reservation_report.py +++ b/hotel_reservation/report/hotel_reservation_report.py @@ -1,8 +1,9 @@ # -*- encoding: utf-8 -*- -############################################################################## +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,14 +19,15 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################# from openerp import models import time from openerp.report import report_sxw class reservation_detail_report(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(reservation_detail_report, self).__init__(cr, uid, name, context) + super(reservation_detail_report, self).__init__(cr, uid, name, + context) self.localcontext.update({ 'time': time, 'get_data': self.get_data, @@ -56,19 +58,25 @@ def _get_room_nos(self, reservation_line): def get_data(self, date_start, date_end): reservation_obj = self.pool.get('hotel.reservation') - tids = reservation_obj.search(self.cr, self.uid, [('checkin', '>=', date_start), ('checkout', '<=', date_end)]) + tids = reservation_obj.search(self.cr, self.uid, + [('checkin', '>=', date_start), + ('checkout', '<=', date_end)]) res = reservation_obj.browse(self.cr, self.uid, tids) return res def get_checkin(self, date_start, date_end): reservation_obj = self.pool.get('hotel.reservation') - tids = reservation_obj.search(self.cr, self.uid, [('checkin', '>=', date_start), ('checkin', '<=', date_end)]) + tids = reservation_obj.search(self.cr, self.uid, + [('checkin', '>=', date_start), + ('checkin', '<=', date_end)]) res = reservation_obj.browse(self.cr, self.uid, tids) return res def get_checkout(self, date_start, date_end): reservation_obj = self.pool.get('hotel.reservation') - tids = reservation_obj.search(self.cr, self.uid, [('checkout', '>=', date_start), ('checkout', '<=', date_end)]) + tids = reservation_obj.search(self.cr, self.uid, + [('checkout', '>=', date_start), + ('checkout', '<=', date_end)]) res = reservation_obj.browse(self.cr, self.uid, tids) return res @@ -82,10 +90,12 @@ def _get_room_used_detail(self, date_start, date_end): details = {} if room.room_reservation_line_ids: for room_resv_line in room.room_reservation_line_ids: - if room_resv_line.check_in >= date_start and room_resv_line.check_in <= date_end: + if(room_resv_line.check_in >= date_start and + room_resv_line.check_in <= date_end): counter += 1 if counter >= 1: - details.update({'name': room.name or '', 'no_of_times_used': counter}) + details.update({'name': room.name or '', + 'no_of_times_used': counter}) room_used_details.append(details) return room_used_details diff --git a/hotel_reservation/views/hotel_reservation_view.xml b/hotel_reservation/views/hotel_reservation_view.xml index 16db456..97626d0 100644 --- a/hotel_reservation/views/hotel_reservation_view.xml +++ b/hotel_reservation/views/hotel_reservation_view.xml @@ -165,7 +165,7 @@ - +
diff --git a/hotel_reservation/wizard/__init__.py b/hotel_reservation/wizard/__init__.py index deeaa1e..7b371c7 100644 --- a/hotel_reservation/wizard/__init__.py +++ b/hotel_reservation/wizard/__init__.py @@ -1,8 +1,9 @@ # -*- encoding: utf-8 -*- -############################################################################## +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,7 +19,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################# + from . import hotel_reservation_wizard # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/hotel_reservation/wizard/hotel_reservation_wizard.py b/hotel_reservation/wizard/hotel_reservation_wizard.py index fe4358d..2d3fd2f 100644 --- a/hotel_reservation/wizard/hotel_reservation_wizard.py +++ b/hotel_reservation/wizard/hotel_reservation_wizard.py @@ -1,8 +1,9 @@ # -*- encoding: utf-8 -*- -############################################################################## +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,7 +19,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################# from openerp import models, fields, api @@ -36,7 +37,10 @@ def report_reservation_detail(self): 'model': 'hotel.reservation', 'form': self.read(['date_start', 'date_end'])[0] } - return self.env['report'].get_action(self, 'hotel_reservation.report_roomres_qweb', data=data) + return self.env['report' + ].get_action(self, + 'hotel_reservation.report_roomres_qweb', + data=data) @api.multi def report_checkin_detail(self): @@ -45,7 +49,10 @@ def report_checkin_detail(self): 'model': 'hotel.reservation', 'form': self.read(['date_start', 'date_end'])[0], } - return self.env['report'].get_action(self, 'hotel_reservation.report_checkin_qweb', data=data) + return self.env['report' + ].get_action(self, + 'hotel_reservation.report_checkin_qweb', + data=data) @api.multi def report_checkout_detail(self): @@ -54,7 +61,10 @@ def report_checkout_detail(self): 'model': 'hotel.reservation', 'form': self.read(['date_start', 'date_end'])[0] } - return self.env['report'].get_action(self, 'hotel_reservation.report_checkout_qweb', data=data) + return self.env['report' + ].get_action(self, + 'hotel_reservation.report_checkout_qweb', + data=data) @api.multi def report_maxroom_detail(self): @@ -63,7 +73,10 @@ def report_maxroom_detail(self): 'model': 'hotel.reservation', 'form': self.read(['date_start', 'date_end'])[0] } - return self.env['report'].get_action(self, 'hotel_reservation.report_maxroom_qweb', data=data) + return self.env['report' + ].get_action(self, + 'hotel_reservation.report_maxroom_qweb', + data=data) class make_folio_wizard(models.TransientModel): @@ -88,5 +101,4 @@ def makeFolios(self): 'type': 'ir.actions.act_window' } - # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/hotel_restaurant/__init__.py b/hotel_restaurant/__init__.py index 95e6909..f0e77e8 100644 --- a/hotel_restaurant/__init__.py +++ b/hotel_restaurant/__init__.py @@ -1,8 +1,9 @@ # -*- encoding: utf-8 -*- -############################################################################## +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,10 +19,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################# from . import models from . import report from . import wizard -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/hotel_restaurant/__openerp__.py b/hotel_restaurant/__openerp__.py index 47fea04..e38fe82 100644 --- a/hotel_restaurant/__openerp__.py +++ b/hotel_restaurant/__openerp__.py @@ -1,8 +1,9 @@ -# -*- coding: utf-8 -*- -############################################################################## +# -*- encoding: utf-8 -*- +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,13 +19,13 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################# { - "name" : "Hotel Restaurant Management", - "version" : "0.05", + "name": "Hotel Restaurant Management", + "version": "0.05", "author": ["Serpent Consulting Services Pvt. Ltd.", "OpenERP SA" ], - "category" : "Generic Modules/Hotel Restaurant", + "category": "Generic Modules/Hotel Restaurant", "description": """ Module for Hotel/Resort/Restaurant management. You can manage: * Configure Property @@ -36,9 +37,9 @@ Different reports are also provided, mainly for Restaurant. """, "website": "http://www.serpentcs.com", - "depends" : ["hotel", "report_extended"], + "depends": ["hotel", "report_extended"], "demo": ["views/hotel_restaurant_data.xml"], - "data" : [ + "data": [ "security/ir.model.access.csv", "report/hotel_restaurant_report.xml", "wizard/hotel_restaurant_wizard.xml", diff --git a/hotel_restaurant/models/__init__.py b/hotel_restaurant/models/__init__.py index 3564175..c1effef 100644 --- a/hotel_restaurant/models/__init__.py +++ b/hotel_restaurant/models/__init__.py @@ -1,8 +1,9 @@ # -*- encoding: utf-8 -*- -############################################################################## +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,6 +19,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################# from . import hotel_restaurant + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/hotel_restaurant/models/hotel_restaurant.py b/hotel_restaurant/models/hotel_restaurant.py index 1bbe1a1..bb2f3c9 100644 --- a/hotel_restaurant/models/hotel_restaurant.py +++ b/hotel_restaurant/models/hotel_restaurant.py @@ -1,8 +1,9 @@ # -*- encoding: utf-8 -*- -############################################################################## +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,7 +19,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################# + from openerp.exceptions import except_orm, ValidationError from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT from openerp import models, fields, api, _, netsvc @@ -44,7 +46,8 @@ class hotel_menucard_type(models.Model): _name = 'hotel.menucard.type' _description = 'Amenities Type' - menu_id = fields.Many2one('product.category', 'Category', required=True, delegate=True, ondelete='cascade') + menu_id = fields.Many2one('product.category', 'Category', required=True, + delegate=True, ondelete='cascade') class hotel_menucard(models.Model): @@ -52,8 +55,11 @@ class hotel_menucard(models.Model): _name = 'hotel.menucard' _description = 'Hotel Menucard' - product_id = fields.Many2one('product.product', 'Product', required=True, delegate=True, ondelete='cascade') - image = fields.Binary("Image", help="This field holds the image used as image for the product, limited to 1024x1024px.") + product_id = fields.Many2one('product.product', 'Product', required=True, + delegate=True, ondelete='cascade') + image = fields.Binary("Image", + help="This field holds the image used as image" \ + "for the product, limited to 1024x1024px.") class hotel_restaurant_tables(models.Model): @@ -70,10 +76,11 @@ class hotel_restaurant_reservation(models.Model): @api.multi def create_order(self): """ - This method is for create a new order for hotel restaurant reservation . - when table is booked and create order button is clicked then this method is called - and order is created.you can see this created order in "Orders" - ----------------------------------------------------------------------------------- + This method is for create a new order for hotel restaurant + reservation .when table is booked and create order button is + clicked then this method is called and order is created.you + can see this created order in "Orders" + ------------------------------------------------------------ @param self: The object pointer @return: new record set for hotel restaurant reservation. """ @@ -92,7 +99,8 @@ def create_order(self): @api.onchange('cname') def onchange_partner_id(self): ''' - When Customer name is changed respective adress will display in Adress field + When Customer name is changed respective adress will display + in Adress field @param self : object pointer ''' if not self.cname: @@ -118,25 +126,35 @@ def action_set_to_draft(self): @api.multi def table_reserved(self): """ - when CONFIRM BUTTON is clicked this method is called for table reservation + when CONFIRM BUTTON is clicked this method is called for + table reservation @param self: The object pointer @return: change a state depending on the condition """ for reservation in self: - self._cr.execute("select count(*) from hotel_restaurant_reservation as hrr " \ - "inner join reservation_table as rt on rt.reservation_table_id = hrr.id " \ - "where (start_date,end_date)overlaps( timestamp %s , timestamp %s ) " \ + self._cr.execute("select count(*) from \ + hotel_restaurant_reservation as hrr " \ + "inner join reservation_table as rt on \ + rt.reservation_table_id = hrr.id " \ + "where (start_date,end_date)overlaps\ + ( timestamp %s , timestamp %s ) " \ "and hrr.id<> %s " \ - "and rt.name in (select rt.name from hotel_restaurant_reservation as hrr " \ - "inner join reservation_table as rt on rt.reservation_table_id = hrr.id " \ + "and rt.name in (select rt.name from \ + hotel_restaurant_reservation as hrr " \ + "inner join reservation_table as rt on \ + rt.reservation_table_id = hrr.id " \ "where hrr.id= %s) " \ - , (reservation.start_date, reservation.end_date, reservation.id, reservation.id)) + , (reservation.start_date, reservation.end_date, + reservation.id, reservation.id)) res = self._cr.fetchone() roomcount = res and res[0] or 0.0 if len(reservation.tableno.ids) == 0: - raise except_orm(_('Warning'), _('Please Select Tables For Reservation')) + raise except_orm(_('Warning'), + _('Please Select Tables For Reservation')) if roomcount: - raise except_orm(_('Warning'), _('You tried to confirm reservation with table those already reserved in this reservation period')) + raise except_orm(_('Warning'), _('You tried to confirm \ + reservation with table those already reserved in this \ + reservation period')) else: self.write({'state':'confirm'}) return True @@ -168,12 +186,24 @@ def table_done(self): reservation_id = fields.Char('Reservation No', size=64, readonly=True) room_no = fields.Many2one('hotel.room', string='Room No', size=64) - start_date = fields.Datetime('Start Time', required=True, default=lambda *a: time.strftime(DEFAULT_SERVER_DATETIME_FORMAT)) + start_date = fields.Datetime('Start Time', required=True, + default=(lambda *a: + time.strftime + (DEFAULT_SERVER_DATETIME_FORMAT))) end_date = fields.Datetime('End Time', required=True) - cname = fields.Many2one('res.partner', string='Customer Name', size=64, required=True) + cname = fields.Many2one('res.partner', string='Customer Name', size=64, + required=True) partner_address_id = fields.Many2one('res.partner', string='Address') - tableno = fields.Many2many('hotel.restaurant.tables', relation='reservation_table', column1='reservation_table_id', column2='name', string='Table Number', help="Table reservation detail. ") - state = fields.Selection([('draft', 'Draft'), ('confirm', 'Confirmed'), ('done', 'Done'), ('cancel', 'Cancelled'), ('order', 'Order Created')], 'state', select=True, required=True, readonly=True, default=lambda * a: 'draft') + tableno = fields.Many2many('hotel.restaurant.tables', + relation='reservation_table', + column1='reservation_table_id', + column2='name', string='Table Number', + help="Table reservation detail. ") + state = fields.Selection([('draft', 'Draft'), ('confirm', 'Confirmed'), + ('done', 'Done'), ('cancel', 'Cancelled'), + ('order', 'Order Created')], 'state', + select=True, required=True, readonly=True, + default=lambda * a: 'draft') @api.model def create(self, vals): @@ -186,7 +216,8 @@ def create(self, vals): vals = {} if self._context is None: self._context = {} - vals['reservation_id'] = self.env['ir.sequence'].get('hotel.restaurant.reservation') + vals['reservation_id' + ] = self.env['ir.sequence'].get('hotel.restaurant.reservation') return super(hotel_restaurant_reservation, self).create(vals) @api.constrains('start_date', 'end_date') @@ -198,7 +229,8 @@ def check_start_dates(self): @return : raise a warning depending on the validation ''' if self.start_date >= self.end_date: - raise ValidationError(_('Start Date Should be less than the End Date!')) + raise ValidationError(_('Start Date Should be less \ + than the End Date!')) class hotel_restaurant_kitchen_order_tickets(models.Model): @@ -211,8 +243,12 @@ class hotel_restaurant_kitchen_order_tickets(models.Model): kot_date = fields.Datetime('Date') room_no = fields.Char('Room No', size=64, readonly=True) w_name = fields.Char('Waiter Name', size=64, readonly=True) - tableno = fields.Many2many('hotel.restaurant.tables', 'temp_table3', 'table_no', 'name', 'Table Number' , size=64, help="Table reservation detail.") - kot_list = fields.One2many('hotel.restaurant.order.list', 'kot_order_list', 'Order List' , help="Kitchen order list") + tableno = fields.Many2many('hotel.restaurant.tables', 'temp_table3', + 'table_no', 'name', 'Table Number', size=64, + help="Table reservation detail.") + kot_list = fields.One2many('hotel.restaurant.order.list', + 'kot_order_list', 'Order List', + help="Kitchen order list") class hotel_restaurant_order(models.Model): @@ -226,7 +262,8 @@ def _sub_total(self): @param self : object pointer ''' for sale in self: - sale.amount_subtotal = sum(line.price_subtotal for line in sale.order_list) + sale.amount_subtotal = sum(line.price_subtotal for line + in sale.order_list) @api.multi @api.depends('amount_subtotal') @@ -237,7 +274,9 @@ def _total(self): @param self : object pointer ''' for line in self: - line.amount_total = line.amount_subtotal + (line.amount_subtotal * line.tax) / 100 + line.amount_total = line.amount_subtotal + (line. + amount_subtotal * + line.tax) / 100 @api.multi def generate_kot(self): @@ -250,7 +289,8 @@ def generate_kot(self): restaurant_order_list_obj = self.env['hotel.restaurant.order.list'] for order in self: if len(order.order_list.ids) == 0: - raise except_orm(_('No Order Given'), _('Please Give an Order')) + raise except_orm(_('No Order Given'), + _('Please Give an Order')) table_ids = [x.id for x in order.table_no] kot_data = order_tickets_obj.create({ 'orderno':order.order_no, @@ -275,14 +315,21 @@ def generate_kot(self): _rec_name = "order_no" order_no = fields.Char('Order Number', size=64, readonly=True) - o_date = fields.Datetime('Start Datetime', required=True, default=lambda *a: time.strftime(DEFAULT_SERVER_DATETIME_FORMAT)) + o_date = fields.Datetime('Start Datetime', required=True, + default=(lambda *a: + time.strftime + (DEFAULT_SERVER_DATETIME_FORMAT))) room_no = fields.Many2one('hotel.room', 'Room No') waiter_name = fields.Many2one('res.partner', 'Waiter Name') - table_no = fields.Many2many('hotel.restaurant.tables', 'temp_table2', 'table_no', 'name', 'Table Number') - order_list = fields.One2many('hotel.restaurant.order.list', 'o_list', 'Order List') + table_no = fields.Many2many('hotel.restaurant.tables', 'temp_table2', + 'table_no', 'name', 'Table Number') + order_list = fields.One2many('hotel.restaurant.order.list', 'o_list', + 'Order List') tax = fields.Float('Tax (%) ') - amount_subtotal = fields.Float(compute='_sub_total', method=True, string='Subtotal') - amount_total = fields.Float(compute='_total', method=True, string='Total1') + amount_subtotal = fields.Float(compute='_sub_total', method=True, + string='Subtotal') + amount_total = fields.Float(compute='_total', method=True, + string='Total1') @api.model def create(self, vals): @@ -295,7 +342,8 @@ def create(self, vals): vals = {} if self._context is None: self._context = {} - vals['order_no'] = self.env['ir.sequence'].get('hotel.restaurant.order') + vals['order_no'] = self.env['ir.sequence' + ].get('hotel.restaurant.order') return super(hotel_restaurant_order, self).create(vals) @@ -310,7 +358,8 @@ def _sub_total(self): @param self : object pointer ''' for sale in self: - sale.amount_subtotal = sum(line.price_subtotal for line in sale.order_list) + sale.amount_subtotal = sum(line.price_subtotal for line + in sale.order_list) @api.multi @api.depends('amount_subtotal') @@ -321,7 +370,8 @@ def _total(self): @param self : object pointer ''' for line in self: - line.amount_total = line.amount_subtotal + (line.amount_subtotal * line.tax) / 100.0 + line.amount_total = line.amount_subtotal + (line.amount_subtotal * + line.tax) / 100.0 @api.multi def reservation_generate_kot(self): @@ -336,7 +386,8 @@ def reservation_generate_kot(self): rest_order_list_obj = self.env['hotel.restaurant.order.list'] for order in self: if len(order.order_list) == 0: - raise except_orm(_('No Order Given'), _('Please Give an Order')) + raise except_orm(_('No Order Given'), + _('Please Give an Order')) table_ids = [x.id for x in order.table_no] line_data = { 'orderno':order.order_number, @@ -364,7 +415,7 @@ def reservation_generate_kot(self): def reservation_update_kot(self): """ This method update record for hotel restaurant order list. - -------------------------------------------------------------- + ---------------------------------------------------------- @param self: The object pointer @return: update record set for hotel restaurant order list. """ @@ -411,16 +462,26 @@ def done_kot(self): order_number = fields.Char('Order No', size=64, readonly=True) reservationno = fields.Char('Reservation No', size=64) - date1 = fields.Datetime('Date', required=True, default=lambda *a: time.strftime(DEFAULT_SERVER_DATETIME_FORMAT)) + date1 = fields.Datetime('Date', required=True, + default=(lambda *a: + time.strftime + (DEFAULT_SERVER_DATETIME_FORMAT))) waitername = fields.Many2one('res.partner', 'Waiter Name') - table_no = fields.Many2many('hotel.restaurant.tables', 'temp_table4', 'table_no', 'name', 'Table Number') - order_list = fields.One2many('hotel.restaurant.order.list', 'o_l', 'Order List') + table_no = fields.Many2many('hotel.restaurant.tables', 'temp_table4', + 'table_no', 'name', 'Table Number') + order_list = fields.One2many('hotel.restaurant.order.list', 'o_l', + 'Order List') tax = fields.Float('Tax (%) ', size=64) - amount_subtotal = fields.Float(compute='_sub_total', method=True, string='Subtotal') + amount_subtotal = fields.Float(compute='_sub_total', method=True, + string='Subtotal') amount_total = fields.Float(compute='_total', method=True, string='Total') kitchen_id = fields.Integer('Kitchen id') - rest_id = fields.Many2many('hotel.restaurant.order.list', 'reserv_id', 'kitchen_id', 'res_kit_ids', "Rest") - state = fields.Selection([('draft', 'Draft'), ('order', 'Order Created'), ('done', 'Done')], 'State', select=True, required=True, readonly=True, default=lambda * a: 'draft') + rest_id = fields.Many2many('hotel.restaurant.order.list', 'reserv_id', + 'kitchen_id', 'res_kit_ids', "Rest") + state = fields.Selection([('draft', 'Draft'), ('order', 'Order Created'), + ('done', 'Done')], 'State', select=True, + required=True, readonly=True, + default=lambda * a: 'draft') @api.model def create(self, vals): @@ -433,7 +494,8 @@ def create(self, vals): vals = {} if self._context is None: self._context = {} - vals['order_number'] = self.env['ir.sequence'].get('hotel.reservation.order') + vals['order_number'] = self.env['ir.sequence' + ].get('hotel.reservation.order') return super(hotel_reservation_order, self).create(vals) @@ -465,10 +527,12 @@ def on_change_item_name(self): o_list = fields.Many2one('hotel.restaurant.order', 'Restaurant Order') o_l = fields.Many2one('hotel.reservation.order', 'Reservation Order') - kot_order_list = fields.Many2one('hotel.restaurant.kitchen.order.tickets', 'Kitchen Order Tickets') + kot_order_list = fields.Many2one('hotel.restaurant.kitchen.order.tickets', + 'Kitchen Order Tickets') name = fields.Many2one('hotel.menucard', 'Item Name', required=True) item_qty = fields.Char('Qty', size=64, required=True) item_rate = fields.Float('Rate', size=64) - price_subtotal = fields.Float(compute='_sub_total', method=True, string='Subtotal') + price_subtotal = fields.Float(compute='_sub_total', method=True, + string='Subtotal') # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/hotel_restaurant/report/__init__.py b/hotel_restaurant/report/__init__.py index 1b37aa0..15aa5a4 100644 --- a/hotel_restaurant/report/__init__.py +++ b/hotel_restaurant/report/__init__.py @@ -1,8 +1,9 @@ # -*- encoding: utf-8 -*- -############################################################################## +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,8 +19,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################# from . import hotel_restaurant_report -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/hotel_restaurant/report/hotel_restaurant_report.py b/hotel_restaurant/report/hotel_restaurant_report.py index d1a059f..edb4fd2 100644 --- a/hotel_restaurant/report/hotel_restaurant_report.py +++ b/hotel_restaurant/report/hotel_restaurant_report.py @@ -1,8 +1,9 @@ # -*- encoding: utf-8 -*- -############################################################################## +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,7 +19,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################# import time from openerp import models @@ -27,15 +28,17 @@ class hotel_restaurant_report(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): super(hotel_restaurant_report, self).__init__(cr, uid, name, context) - self.localcontext.update( { + self.localcontext.update({ 'time': time, 'get_res_data':self.get_res_data, }) - self.context=context + self.context = context - def get_res_data(self,date_start,date_end): + def get_res_data(self, date_start, date_end): rest_reservation_obj = self.pool.get('hotel.restaurant.reservation') - tids = rest_reservation_obj.search(self.cr, self.uid, [('start_date', '>=', date_start),('end_date', '<=', date_end)]) + tids = rest_reservation_obj.search(self.cr, self.uid, + [('start_date', '>=', date_start), + ('end_date', '<=', date_end)]) res = rest_reservation_obj.browse(self.cr, self.uid, tids) return res @@ -57,4 +60,4 @@ class report_bill(models.AbstractModel): _template = 'hotel_restaurant.report_hotel_order_kot' _wrapped_report_class = hotel_restaurant_report -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/hotel_restaurant/wizard/__init__.py b/hotel_restaurant/wizard/__init__.py index e89731c..cf001a6 100644 --- a/hotel_restaurant/wizard/__init__.py +++ b/hotel_restaurant/wizard/__init__.py @@ -1,8 +1,9 @@ # -*- encoding: utf-8 -*- -############################################################################## +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,8 +19,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################# from . import hotel_restaurant_wizard -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/hotel_restaurant/wizard/hotel_restaurant_wizard.py b/hotel_restaurant/wizard/hotel_restaurant_wizard.py index 062abac..5f491f6 100644 --- a/hotel_restaurant/wizard/hotel_restaurant_wizard.py +++ b/hotel_restaurant/wizard/hotel_restaurant_wizard.py @@ -1,8 +1,9 @@ # -*- encoding: utf-8 -*- -############################################################################## +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,9 +19,9 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################# -from openerp import models,fields,api +from openerp import models, fields, api class wizard_hotel_restaurant(models.TransientModel): @@ -36,8 +37,11 @@ def print_report(self): 'model': 'hotel.restaurant.reservation', 'form': self.read(['date_start', 'date_end'])[0] } - return self.env['report'].get_action(self, 'hotel_restaurant.report_res_table',data=data) + return self.env['report' + ].get_action(self, + 'hotel_restaurant.report_res_table', + data=data) wizard_hotel_restaurant() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/report_extended/__init__.py b/report_extended/__init__.py index e69de29..d5a1682 100644 --- a/report_extended/__init__.py +++ b/report_extended/__init__.py @@ -0,0 +1,22 @@ +# -*- encoding: utf-8 -*- +############################################################################# +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () +# Copyright (C) 2004 OpenERP SA () +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see +# +############################################################################# diff --git a/report_extended/__openerp__.py b/report_extended/__openerp__.py index 016aaa5..ee6cade 100644 --- a/report_extended/__openerp__.py +++ b/report_extended/__openerp__.py @@ -1,8 +1,9 @@ -# -*- coding: utf-8 -*- -############################################################################## +# -*- encoding: utf-8 -*- +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,7 +19,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################# { 'name': 'Report Extended', @@ -26,7 +27,8 @@ 'summary': 'Report', 'version': '0.01', 'description': """ - Report Extended Which Insert The Header Of Company's Full Address In Qweb Report + Report Extended Which Insert The Header Of Company's Full Address + In Qweb Report """, "author": ["Serpent Consulting Services Pvt. Ltd.", "OpenERP SA" ], "website": "http://www.serpentcs.com", @@ -37,3 +39,5 @@ 'installable': True, 'auto_install': True, } + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/report_hotel_reservation/__init__.py b/report_hotel_reservation/__init__.py index 4076188..2af5a53 100644 --- a/report_hotel_reservation/__init__.py +++ b/report_hotel_reservation/__init__.py @@ -1,8 +1,9 @@ # -*- encoding: utf-8 -*- -############################################################################## +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,8 +19,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################# from . import models -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/report_hotel_reservation/__openerp__.py b/report_hotel_reservation/__openerp__.py index 81e1f9e..0a1d895 100644 --- a/report_hotel_reservation/__openerp__.py +++ b/report_hotel_reservation/__openerp__.py @@ -1,8 +1,9 @@ -# -*- coding: utf-8 -*- -############################################################################## +# -*- encoding: utf-8 -*- +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,15 +19,15 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################# { - "name" : "Hotel Reservation Management - Reporting", - "version" : "0.03", + "name": "Hotel Reservation Management - Reporting", + "version": "0.03", "author": ["Serpent Consulting Services Pvt. Ltd.", "OpenERP SA" ], "website": ["http://www.serpentcs.com", "http://www.openerp.com"], - "depends" : ["hotel_reservation"], - "category" : "Generic Modules/Hotel Reservation", + "depends": ["hotel_reservation"], + "category": "Generic Modules/Hotel Reservation", "description": """ Module shows the status of room reservation * Current status of reserved room @@ -40,4 +41,4 @@ 'auto_install': False, } -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/report_hotel_reservation/models/__init__.py b/report_hotel_reservation/models/__init__.py index 0047fda..a35016b 100644 --- a/report_hotel_reservation/models/__init__.py +++ b/report_hotel_reservation/models/__init__.py @@ -1,8 +1,9 @@ # -*- encoding: utf-8 -*- -############################################################################## +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,6 +19,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################# -from . import report_hotel_reservation \ No newline at end of file +from . import report_hotel_reservation + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/report_hotel_reservation/models/report_hotel_reservation.py b/report_hotel_reservation/models/report_hotel_reservation.py index 1517348..93c26c0 100644 --- a/report_hotel_reservation/models/report_hotel_reservation.py +++ b/report_hotel_reservation/models/report_hotel_reservation.py @@ -1,8 +1,9 @@ # -*- encoding: utf-8 -*- -############################################################################## +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,8 +19,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## -from openerp import models,fields +############################################################################# +from openerp import models, fields AVAILABLE_STATES = [ ('draft', 'Draft'), @@ -34,11 +35,13 @@ class report_hotel_reservation_status(models.Model): reservation_no = fields.Char('Reservation No', size=64, readonly=True) nbr = fields.Integer('Reservation', readonly=True) - state = fields.Selection(AVAILABLE_STATES, 'State', size=16, readonly=True) + state = fields.Selection(AVAILABLE_STATES, 'State', size=16, + readonly=True) - def init(self,cr): + def init(self, cr): """ - This method is for initialization for report hotel reservation status Module. + This method is for initialization for report hotel reservation + status Module. @param self: The object pointer @param cr: database cursor """ @@ -54,5 +57,4 @@ def init(self,cr): group by c.state,c.reservation_no )""") - # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/report_hotel_restaurant/__init__.py b/report_hotel_restaurant/__init__.py index 4076188..2af5a53 100644 --- a/report_hotel_restaurant/__init__.py +++ b/report_hotel_restaurant/__init__.py @@ -1,8 +1,9 @@ # -*- encoding: utf-8 -*- -############################################################################## +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,8 +19,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################# from . import models -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/report_hotel_restaurant/__openerp__.py b/report_hotel_restaurant/__openerp__.py index f40569b..06f18af 100644 --- a/report_hotel_restaurant/__openerp__.py +++ b/report_hotel_restaurant/__openerp__.py @@ -1,8 +1,9 @@ -# -*- coding: utf-8 -*- -############################################################################## +# -*- encoding: utf-8 -*- +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,15 +19,15 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################# { - "name" : "Restaurant Management - Reporting", - "version" : "0.03", + "name": "Restaurant Management - Reporting", + "version": "0.03", "author": ["Serpent Consulting Services Pvt. Ltd.", "OpenERP SA" ], "website": ["http://www.serpentcs.com", "http://www.openerp.com"], - "depends" : ["hotel_restaurant", "report_hotel_reservation"], - "category" : "Generic Modules/Hotel Restaurant", + "depends": ["hotel_restaurant", "report_hotel_reservation"], + "category": "Generic Modules/Hotel Restaurant", "description": """ Module shows the status of restaurant reservation * Current status of reserved tables @@ -40,4 +41,4 @@ 'auto_install': False, } -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/report_hotel_restaurant/models/__init__.py b/report_hotel_restaurant/models/__init__.py index db3c629..d043889 100644 --- a/report_hotel_restaurant/models/__init__.py +++ b/report_hotel_restaurant/models/__init__.py @@ -1,8 +1,9 @@ # -*- encoding: utf-8 -*- -############################################################################## +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,6 +19,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################# -from . import report_hotel_restaurant \ No newline at end of file +from . import report_hotel_restaurant + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/report_hotel_restaurant/models/report_hotel_restaurant.py b/report_hotel_restaurant/models/report_hotel_restaurant.py index d497ea4..cf7b637 100644 --- a/report_hotel_restaurant/models/report_hotel_restaurant.py +++ b/report_hotel_restaurant/models/report_hotel_restaurant.py @@ -1,8 +1,9 @@ # -*- encoding: utf-8 -*- -############################################################################## +############################################################################# # # OpenERP, Open Source Management Solution -# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. () +# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd. +# () # Copyright (C) 2004 OpenERP SA () # # This program is free software: you can redistribute it and/or modify @@ -18,9 +19,9 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see # -############################################################################## +############################################################################# -from openerp import models,fields +from openerp import models, fields AVAILABLE_STATES = [ ('draft', 'Draft'), @@ -35,11 +36,13 @@ class report_hotel_restaurant_status(models.Model): reservation_id = fields.Char('Reservation No', size=64, readonly=True) nbr = fields.Integer('Reservation', readonly=True) - state = fields.Selection(AVAILABLE_STATES, 'State', size=16, readonly=True) + state = fields.Selection(AVAILABLE_STATES, 'State', size=16, + readonly=True) - def init(self,cr): + def init(self, cr): """ - This method is for initialization for report hotel restaurant status Module. + This method is for initialization for report hotel restaurant + status Module. @param self: The object pointer @param cr: database cursor """ @@ -55,5 +58,4 @@ def init(self,cr): group by c.state,c.reservation_id )""") - # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: