diff --git a/addons/point_of_sale/__manifest__.py b/addons/point_of_sale/__manifest__.py
index 6b5353e17df..46492ba0fbb 100644
--- a/addons/point_of_sale/__manifest__.py
+++ b/addons/point_of_sale/__manifest__.py
@@ -6,7 +6,7 @@
'version': '1.0.1',
'category': 'Sales/Point Of Sale',
'sequence': 20,
- 'summary': 'Tablet POS: shops and restaurants',
+ 'summary': 'User-friendly PoS interface for shops and restaurants',
'description': "",
'depends': ['stock_account', 'barcodes', 'web_editor', 'digest'],
'data': [
diff --git a/addons/point_of_sale/models/pos_config.py b/addons/point_of_sale/models/pos_config.py
index 99007a7abd9..ef8a8479260 100644
--- a/addons/point_of_sale/models/pos_config.py
+++ b/addons/point_of_sale/models/pos_config.py
@@ -63,14 +63,7 @@ class PosConfig(models.Model):
def _compute_default_customer_html(self):
return self.env['ir.qweb'].render('point_of_sale.customer_facing_display_html')
- @api.depends('limit_categories', 'iface_available_categ_ids')
- def _compute_iface_start_categ_domain_ids(self):
- if self.limit_categories:
- self.iface_start_categ_domain_ids = self.iface_available_categ_ids
- else:
- self.iface_start_categ_domain_ids = self.env['pos.category'].search([])
-
- name = fields.Char(string='Point of Sale Name', index=True, required=True, help="An internal identification of the point of sale.")
+ name = fields.Char(string='Point of Sale', index=True, required=True, help="An internal identification of the point of sale.")
is_installed_account_accountant = fields.Boolean(string="Is the Full Accounting Installed",
compute="_compute_is_installed_account_accountant")
journal_ids = fields.Many2many(
@@ -110,10 +103,8 @@ class PosConfig(models.Model):
iface_tax_included = fields.Selection([('subtotal', 'Tax-Excluded Price'), ('total', 'Tax-Included Price')], string="Tax Display", default='subtotal', required=True)
iface_start_categ_id = fields.Many2one('pos.category', string='Initial Category',
help='The point of sale will display this product category by default. If no category is specified, all available products will be shown.')
- iface_available_categ_ids = fields.Many2many('pos.category', string='Available Category Tree',
+ iface_available_categ_ids = fields.Many2many('pos.category', string='Available PoS Product Categories',
help='The point of sale will only display products which are within one of the selected category trees. If no category is specified, all available products will be shown')
- iface_start_categ_domain_ids = fields.Many2many('pos.category', compute='_compute_iface_start_categ_domain_ids', store=False,
- help='Technical field used as a domain for iface_start_categ_id.')
iface_display_categ_images = fields.Boolean(string='Display Category Pictures',
help="The product categories will be displayed with pictures.")
restrict_price_control = fields.Boolean(string='Restrict Price Modifications to Managers',
@@ -164,7 +155,7 @@ class PosConfig(models.Model):
use_pricelist = fields.Boolean("Use a pricelist.")
tax_regime = fields.Boolean("Tax Regime")
tax_regime_selection = fields.Boolean("Tax Regime Selection value")
- start_category = fields.Boolean("Set Start Category")
+ start_category = fields.Boolean("Set Start Category", default=False)
limit_categories = fields.Boolean("Restrict Available Product Categories")
module_account = fields.Boolean(string='Invoicing', help='Enables invoice generation from the Point of Sale.')
module_pos_restaurant = fields.Boolean("Is a Bar/Restaurant")
@@ -322,10 +313,16 @@ class PosConfig(models.Model):
@api.onchange('limit_categories', 'iface_available_categ_ids', 'iface_start_categ_id')
def _onchange_limit_categories(self):
+ res = {}
if not self.limit_categories:
self.iface_available_categ_ids = False
+ elif not len(self.iface_available_categ_ids):
+ res = {'domain': {'iface_start_categ_id': [('id', 'in', self.env['pos.category'].search([]).ids)]}}
elif self.iface_start_categ_id not in self.iface_available_categ_ids:
self.iface_start_categ_id = False
+ if self.iface_available_categ_ids:
+ res = {'domain': {'iface_start_categ_id': [('id', 'in', self.iface_available_categ_ids.ids)]}}
+ return res
@api.onchange('is_header_or_footer')
def _onchange_header_footer(self):
diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js
index 2840b6b2866..9ae632ae1d6 100644
--- a/addons/point_of_sale/static/src/js/models.js
+++ b/addons/point_of_sale/static/src/js/models.js
@@ -333,7 +333,7 @@ exports.PosModel = Backbone.Model.extend({
model: 'pos.category',
fields: ['id', 'name', 'parent_id', 'child_id'],
domain: function(self) {
- return self.config.limit_categories ? [['id', 'in', self.config.iface_available_categ_ids]] : [];
+ return self.config.limit_categories && self.config.iface_available_categ_ids.length ? [['id', 'in', self.config.iface_available_categ_ids]] : [];
},
loaded: function(self, categories){
self.db.add_categories(categories);
@@ -346,7 +346,7 @@ exports.PosModel = Backbone.Model.extend({
order: _.map(['sequence','default_code','name'], function (name) { return {name: name}; }),
domain: function(self){
var domain = [['sale_ok','=',true],['available_in_pos','=',true]];
- if (self.config.limit_categories) {
+ if (self.config.limit_categories && self.config.iface_available_categ_ids.length) {
domain.push(['pos_categ_id', 'in', self.config.iface_available_categ_ids]);
}
return domain;
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 c45bc2e19cf..cd627937472 100644
--- a/addons/point_of_sale/views/point_of_sale_dashboard.xml
+++ b/addons/point_of_sale/views/point_of_sale_dashboard.xml
@@ -66,9 +66,6 @@