# -*- coding: utf-8 -*- ############################################################################## # # Cybrosys Technologies Pvt. Ltd. # Copyright (C) 2009-TODAY Cybrosys Technologies(). # # you can modify it under the terms of the GNU LESSER # GENERAL PUBLIC LICENSE (LGPL v3), Version 3. # # It is forbidden to publish, distribute, sublicense, or sell copies # of the Software or modified copies of the Software. # # 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. # # You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE # GENERAL PUBLIC LICENSE (LGPL v3) along with this program. # If not, see . # ############################################################################## from openerp import models, fields, api class CabBooking(models.Model): _name = 'cab.booking' _rec_name = 'booking_date' booking_date = fields.Date(string="Booking Date", required=True) cab_timing = fields.Many2one('cab.time', string="Timing", required=True) cab_routes = fields.Many2one('cab.location', string="Route", required=True) seat_available = fields.One2many('cab.timing', compute="scheduled_details") @api.onchange('cab_routes', 'cab_timing') def scheduled_details(self): data = self.env['cab.timing'].search([('cab_route.name', '=', self.cab_routes.name), ('cab_time.name', '=', self.cab_timing.name)]) self.seat_available = data