From bedfaac989a1a9e90a7b9b0269755c0a47f5ee99 Mon Sep 17 00:00:00 2001 From: Darshil Trivedi Date: Fri, 18 Jan 2019 06:27:21 +0000 Subject: [PATCH] [IMP] point_of_sale: point of sale onboarding improvement. - Improved description of point of sale application - Removed status from card like 'In Progress' and 'Unused' - Click on top-right corner of POS kanban card, it shows 'Sessions' and 'Sales Orders', now it will shows 'Orders' and 'Sessions'. (for usability purpose). - Improved Multi-Currencies wording same as invoicing - Removed 'Advanced Currencies Setup' from settings(when clicking on 'Multi-Currencies'). - Improved list view label on 'Point of Sale'. - Added 'PoS Product Categories' feature in 'Restrict Available Product Categories'. - In PoS config setting, 'Pos Interface' string is put instead of 'Order Interface'. - Filter and display issues were there when setting 'Currencies' from 'Multi-Currencies', now it is resolved. - String 'PoS Product categories' is put instead of 'PoS Category', as it seems meaningful. - 'Restrict Available Product Category' is ticked but any category is not selected (it means it is kept blank), then all categories are shown at POS screen. - Allow to set default category from the available categories - 'iface_start_categ_domain_ids' is removed because domain for 'iface_start_categ_id' is given directly in the model. So 'iface_start_categ_domain_ids' will not be required anymore. This commit is related to task id: 1925458 closes odoo/odoo#30808 Signed-off-by: Quentin Lejeune (qle) --- addons/point_of_sale/__manifest__.py | 2 +- addons/point_of_sale/models/pos_config.py | 21 +++++------ addons/point_of_sale/static/src/js/models.js | 4 +-- .../views/point_of_sale_dashboard.xml | 9 ++--- .../point_of_sale/views/pos_category_view.xml | 17 +++++---- .../point_of_sale/views/pos_config_view.xml | 36 ++++++++++--------- .../views/res_config_settings_views.xml | 5 +-- odoo/addons/base/views/res_currency_views.xml | 1 - 8 files changed, 45 insertions(+), 50 deletions(-) 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 @@
Opening Control
- -
In Progress
-
Closing Control
@@ -78,8 +75,6 @@ To Close - Unused -
@@ -125,10 +120,10 @@ View
- Sessions + Orders
- Sales Orders + Sessions
diff --git a/addons/point_of_sale/views/pos_category_view.xml b/addons/point_of_sale/views/pos_category_view.xml index 1c7d461fbea..60a817684f4 100644 --- a/addons/point_of_sale/views/pos_category_view.xml +++ b/addons/point_of_sale/views/pos_category_view.xml @@ -4,16 +4,21 @@ pos.category.form pos.category -
+ -
+
+
+ - -
+
@@ -25,7 +30,7 @@ - + @@ -57,7 +62,7 @@ - PoS Categories + PoS Product Categories ir.actions.act_window pos.category form diff --git a/addons/point_of_sale/views/pos_config_view.xml b/addons/point_of_sale/views/pos_config_view.xml index 98bc90000a4..6c48f2d0af5 100644 --- a/addons/point_of_sale/views/pos_config_view.xml +++ b/addons/point_of_sale/views/pos_config_view.xml @@ -73,7 +73,7 @@
-

Order Interface

+

PoS Interface

@@ -85,22 +85,7 @@ Display pictures of product categories
-
-
-
-
- -
- -
-
-
@@ -116,6 +101,9 @@
+
+
@@ -129,6 +117,20 @@
+
+
+ +
+
+
+
diff --git a/addons/point_of_sale/views/res_config_settings_views.xml b/addons/point_of_sale/views/res_config_settings_views.xml index df27f9e2f98..0f8076d74ed 100644 --- a/addons/point_of_sale/views/res_config_settings_views.xml +++ b/addons/point_of_sale/views/res_config_settings_views.xml @@ -57,15 +57,12 @@
diff --git a/odoo/addons/base/views/res_currency_views.xml b/odoo/addons/base/views/res_currency_views.xml index aeb18b9781c..7ff413648fd 100644 --- a/odoo/addons/base/views/res_currency_views.xml +++ b/odoo/addons/base/views/res_currency_views.xml @@ -60,7 +60,6 @@ -