1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- # -*- coding: utf-8 -*-
- # Copyright 2017 OpenSynergy Indonesia
- # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
- from openerp import models, fields, api
- class PosTable(models.Model):
- _name = "pos.table"
- _description = "PoS Table"
- name = fields.Char(string="Nombre")
- employee_id = fields.Many2one(
- string="Chofer",
- comodel_name="hr.employee"
- )
- floor_id = fields.Many2one(
- string="Agrupado por",
- comodel_name="pos.floor",
- required=True,
- )
- type = fields.Selection([
- ('table','Mesa'),
- ('delivery','Delivery')],
- string="Tipo",
- required=True,
- related="floor_id.type"
- )
- capacity = fields.Integer(
- string="Capacidad",
- )
- state = fields.Selection(
- string="Estado",
- selection=[
- ("available", "Disponible"),
- ("vacant", "Vacant"),
- ("reserved", "Reservado"),
- ],
- required=True,
- default="available",
- )
- @api.one
- @api.onchange('employee_id')
- def onchange_employee_id(self):
- if self.employee_id:
- self.name = self.employee_id.name_related
|