# -*- coding: utf-8 -*- ############################################################################## # # Cybrosys Technologies Pvt. Ltd. # Copyright (C) 2017-TODAY Cybrosys Technologies(). # Author: Avinash Nk() # 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 odoo import models, fields, api class SalonWorkingHours(models.Model): _name = 'salon.working.hours' name = fields.Char(string="Name") from_time = fields.Float(string="Starting Time") to_time = fields.Float(string="Closing Time") class SalonHoliday(models.Model): _name = 'salon.holiday' name = fields.Char(string="Name") holiday = fields.Boolean(string="Holiday") class WorkshopSetting(models.Model): _name = "salon.config.settings" @api.model def booking_chairs(self): return self.env['salon.chair'].search([('active_booking_chairs', '=', True)]) @api.model def holidays(self): return self.env['salon.holiday'].search([('holiday', '=', True)]) salon_booking_chairs = fields.Many2many('salon.chair', string="Booking Chairs", default=booking_chairs) salon_holidays = fields.Many2many('salon.holiday', string="Holidays", default=holidays) @api.multi def execute(self): salon_chair_obj = self.env['salon.chair'].search([]) book_chair = [] for chairs in self.salon_booking_chairs: book_chair.append(chairs.id) for records in salon_chair_obj: if records.id in book_chair: records.active_booking_chairs = True else: records.active_booking_chairs = False salon_holiday_obj = self.env['salon.holiday'].search([]) holiday = [] for days in self.salon_holidays: holiday.append(days.id) for records in salon_holiday_obj: if records.id in holiday: records.holiday = True else: records.holiday = False