pos_order.py 852 B

1234567891011121314151617181920212223
  1. # -*- coding: utf-8 -*-
  2. # Copyright 2017 OpenSynergy Indonesia
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  4. from openerp import models, fields
  5. class PosOrder(models.Model):
  6. _inherit = "pos.order"
  7. table_id = fields.Many2one(string="Mesas/Delivery",comodel_name="pos.table")
  8. pos_type = fields.Selection([
  9. ('table','Mesa'),
  10. ('delivery','Delivery')], related='table_id.type',string="Tipo", store=True, readonly=True)
  11. employee_id = fields.Many2one(related='table_id.employee_id', string="Choferes", store=True, readonly=True)
  12. def _order_fields(self, cr, uid, ui_order, context=None):
  13. res = super(PosOrder, self)._order_fields(
  14. cr, uid, ui_order, context=context
  15. )
  16. if "table" in ui_order:
  17. res['table_id'] = ui_order['table']['id']
  18. return res