You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							59 lines
						
					
					
						
							2.4 KiB
						
					
					
				
			
		
		
		
			
			
			
		
		
	
	
							59 lines
						
					
					
						
							2.4 KiB
						
					
					
				
								# -*- coding: utf-8 -*-
							 | 
						|
								#############################################################################
							 | 
						|
								#
							 | 
						|
								#    Cybrosys Technologies Pvt. Ltd.
							 | 
						|
								#
							 | 
						|
								#    Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
							 | 
						|
								#    Author: Gaythri v (odoo@cybrosys.com)
							 | 
						|
								#
							 | 
						|
								#    You can modify it under the terms of the GNU LESSER
							 | 
						|
								#    GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
							 | 
						|
								#
							 | 
						|
								#    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
							 | 
						|
								#    (LGPL v3) along with this program.
							 | 
						|
								#    If not, see <http://www.gnu.org/licenses/>.
							 | 
						|
								#
							 | 
						|
								#############################################################################
							 | 
						|
								from odoo import api, fields, models
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								class KitchenScreen(models.Model):
							 | 
						|
								    """Kitchen Screen model for the cook"""
							 | 
						|
								    _name = 'kitchen.screen'
							 | 
						|
								    _description = 'Pos Kitchen Screen'
							 | 
						|
								    _rec_name = 'sequence'
							 | 
						|
								
							 | 
						|
								    def _pos_shop_id(self):
							 | 
						|
								        """Domain for the Pos Shop"""
							 | 
						|
								        kitchen = self.search([])
							 | 
						|
								        if kitchen:
							 | 
						|
								            return [('module_pos_restaurant', '=', True),
							 | 
						|
								                    ('id', 'not in', [rec.id for rec in kitchen.pos_config_id])]
							 | 
						|
								        else:
							 | 
						|
								            return [('module_pos_restaurant', '=', True)]
							 | 
						|
								
							 | 
						|
								    sequence = fields.Char(readonly=True, default='New',
							 | 
						|
								                           copy=False, tracking=True, help="Sequence of items")
							 | 
						|
								    pos_config_id = fields.Many2one('pos.config', string='Allowed POS',
							 | 
						|
								                                    domain=_pos_shop_id,
							 | 
						|
								                                    help="Allowed POS for kitchen")
							 | 
						|
								    pos_categ_ids = fields.Many2many('pos.category', required=True,
							 | 
						|
								                                     string='Allowed POS Category',
							 | 
						|
								                                     help="Allowed POS Category"
							 | 
						|
								                                          "for the corresponding Pos ")
							 | 
						|
								    shop_number = fields.Integer(related='pos_config_id.id', string='Customer',
							 | 
						|
								                                 help="Id of the POS")
							 | 
						|
								
							 | 
						|
								    @api.model
							 | 
						|
								    def create(self, vals):
							 | 
						|
								        """Used to create sequence"""
							 | 
						|
								        if vals.get('sequence', 'New') == 'New':
							 | 
						|
								            vals['sequence'] = self.env['ir.sequence'].next_by_code(
							 | 
						|
								                'kitchen.screen')
							 | 
						|
								        result = super(KitchenScreen, self).create(vals)
							 | 
						|
								        return result
							 | 
						|
								
							 |