From bbaf9563285bb1b8ef8c9cec4402f66912ff4334 Mon Sep 17 00:00:00 2001 From: Joren Van Onder Date: Wed, 20 Apr 2016 11:53:39 +0200 Subject: [PATCH] [IMP] point_of_sale: make pos.config use active instead of custom state pos.config had a special state field that mimiced what we usually do with an 'active' field. The concepts of 'inactive' and 'deprecated' seem to have never been fully worked out, as both of them resulted in the same behaviour. --- addons/point_of_sale/models/pos_config.py | 20 +------------------ addons/point_of_sale/models/pos_session.py | 3 +-- .../views/point_of_sale_dashboard.xml | 1 - .../point_of_sale/views/pos_config_view.xml | 14 +++---------- 4 files changed, 5 insertions(+), 33 deletions(-) diff --git a/addons/point_of_sale/models/pos_config.py b/addons/point_of_sale/models/pos_config.py index bc374e16234..1f73121ffed 100644 --- a/addons/point_of_sale/models/pos_config.py +++ b/addons/point_of_sale/models/pos_config.py @@ -8,12 +8,6 @@ from odoo.exceptions import UserError class PosConfig(models.Model): _name = 'pos.config' - POS_CONFIG_STATE = [ - ('active', 'Active'), - ('inactive', 'Inactive'), - ('deprecated', 'Deprecated') - ] - def _default_sale_journal(self): return self.env['account.journal'].search([('type', '=', 'sale'), ('company_id', '=', self.env.user.company_id.id)], limit=1) @@ -72,7 +66,7 @@ class PosConfig(models.Model): receipt_footer = fields.Text(string='Receipt Footer', help="A short text that will be inserted as a footer in the printed receipt") proxy_ip = fields.Char(string='IP Address', size=45, help='The hostname or ip address of the hardware proxy, Will be autodetected if left empty') - state = fields.Selection(POS_CONFIG_STATE, string='Status', required=True, readonly=True, copy=False, default=POS_CONFIG_STATE[0][0]) + active = fields.Boolean(default=True) uuid = fields.Char(readonly=True, default=lambda self: str(uuid.uuid4()), help='A globally unique identifier for this pos configuration, used to prevent conflicts in client-generated data') sequence_id = fields.Many2one('ir.sequence', string='Order IDs Sequence', readonly=True, @@ -198,18 +192,6 @@ class PosConfig(models.Model): pos_config.sequence_id.unlink() return super(PosConfig, self).unlink() - @api.multi - def set_active(self): - self.write({'state': 'active'}) - - @api.multi - def set_inactive(self): - self.write({'state': 'inactive'}) - - @api.multi - def set_deprecate(self): - self.write({'state': 'deprecated'}) - # Methods to open the POS @api.multi def open_ui(self): diff --git a/addons/point_of_sale/models/pos_session.py b/addons/point_of_sale/models/pos_session.py index d9114143e15..162f89b0462 100644 --- a/addons/point_of_sale/models/pos_session.py +++ b/addons/point_of_sale/models/pos_session.py @@ -29,8 +29,7 @@ class PosSession(models.Model): 'pos.config', string='Point of Sale', help="The physical point of sale you will use.", required=True, - index=True, - domain="[('state', '=', 'active')]") + index=True) name = fields.Char(string='Session ID', required=True, readonly=True, default='/') user_id = fields.Many2one( 'res.users', string='Responsible', diff --git a/addons/point_of_sale/views/point_of_sale_dashboard.xml b/addons/point_of_sale/views/point_of_sale_dashboard.xml index 77ea4c3b215..93431429ed5 100644 --- a/addons/point_of_sale/views/point_of_sale_dashboard.xml +++ b/addons/point_of_sale/views/point_of_sale_dashboard.xml @@ -46,7 +46,6 @@ pos.config - diff --git a/addons/point_of_sale/views/pos_config_view.xml b/addons/point_of_sale/views/pos_config_view.xml index a744829a6bb..77f30c9830f 100644 --- a/addons/point_of_sale/views/pos_config_view.xml +++ b/addons/point_of_sale/views/pos_config_view.xml @@ -5,13 +5,6 @@ pos.config
-
-
-