From 2913337fd7addc8400606e98100a81a7d2af0fc9 Mon Sep 17 00:00:00 2001 From: Joseph Caburnay Date: Wed, 14 Aug 2019 14:06:12 +0000 Subject: [PATCH] [IMP] point_of_sale: B2B ease navigation within PoS TASK-ID: 2050245 closes odoo/odoo#35716 Signed-off-by: pimodoo --- addons/point_of_sale/models/pos_category.py | 2 +- addons/point_of_sale/models/pos_config.py | 3 +++ addons/point_of_sale/models/pos_order.py | 2 +- addons/point_of_sale/static/src/css/pos.css | 17 +++++++++++-- .../point_of_sale/static/src/img/search.png | Bin 505 -> 0 bytes addons/point_of_sale/static/src/js/screens.js | 10 +++++--- .../static/src/js/tours/point_of_sale.js | 6 +++-- addons/point_of_sale/static/src/xml/pos.xml | 23 +++++++++++++++--- .../views/point_of_sale_dashboard.xml | 11 +++++++++ .../views/point_of_sale_sequence.xml | 4 +-- .../point_of_sale/views/pos_category_view.xml | 4 +-- .../point_of_sale/views/pos_config_view.xml | 2 +- addons/point_of_sale/views/pos_order_view.xml | 3 ++- .../point_of_sale/views/pos_session_view.xml | 1 - 14 files changed, 68 insertions(+), 20 deletions(-) delete mode 100644 addons/point_of_sale/static/src/img/search.png diff --git a/addons/point_of_sale/models/pos_category.py b/addons/point_of_sale/models/pos_category.py index c3f40d94478..2f2ea7bb94e 100644 --- a/addons/point_of_sale/models/pos_category.py +++ b/addons/point_of_sale/models/pos_category.py @@ -13,7 +13,7 @@ class PosCategory(models.Model): if not self._check_recursion(): raise ValueError(_('Error ! You cannot create recursive categories.')) - name = fields.Char(required=True, translate=True) + name = fields.Char(string='Category Name', required=True, translate=True) parent_id = fields.Many2one('pos.category', string='Parent Category', index=True) child_id = fields.One2many('pos.category', 'parent_id', string='Children Categories') sequence = fields.Integer(help="Gives the sequence order when displaying a list of product categories.") diff --git a/addons/point_of_sale/models/pos_config.py b/addons/point_of_sale/models/pos_config.py index 3f4041c9cbf..247c4e1d008 100644 --- a/addons/point_of_sale/models/pos_config.py +++ b/addons/point_of_sale/models/pos_config.py @@ -202,6 +202,7 @@ class PosConfig(models.Model): "the closing of his session saying that he needs to contact his manager.") payment_method_ids = fields.Many2many('pos.payment.method', string='Payment Methods', default=lambda self: self._default_payment_methods()) company_has_template = fields.Boolean(string="Company has chart of accounts", compute="_compute_company_has_template") + current_user_id = fields.Many2one('res.users', string='Current Session Responsible', compute='_compute_current_session_user') @api.depends('company_id') def _compute_company_has_template(self): @@ -262,10 +263,12 @@ class PosConfig(models.Model): pos_config.pos_session_duration = ( datetime.now() - session[0].start_at ).days if session[0].start_at else 0 + pos_config.current_user_id = session[0].user_id else: pos_config.pos_session_username = False pos_config.pos_session_state = False pos_config.pos_session_duration = 0 + pos_config.current_user_id = False @api.constrains('cash_control') def _check_session_state(self): diff --git a/addons/point_of_sale/models/pos_order.py b/addons/point_of_sale/models/pos_order.py index d34192ee4ca..49ffd4ecb68 100644 --- a/addons/point_of_sale/models/pos_order.py +++ b/addons/point_of_sale/models/pos_order.py @@ -186,7 +186,7 @@ class PosOrder(models.Model): ) note = fields.Text(string='Internal Notes') nb_print = fields.Integer(string='Number of Print', readonly=True, copy=False, default=0) - pos_reference = fields.Char(string='PoS Order Reference', readonly=True, copy=False) + pos_reference = fields.Char(string='Receipt Number', readonly=True, copy=False) sale_journal = fields.Many2one('account.journal', related='session_id.config_id.journal_id', string='Sales Journal', store=True, readonly=True) fiscal_position_id = fields.Many2one( comodel_name='account.fiscal.position', string='Fiscal Position', diff --git a/addons/point_of_sale/static/src/css/pos.css b/addons/point_of_sale/static/src/css/pos.css index ee107136876..9addf1edde5 100644 --- a/addons/point_of_sale/static/src/css/pos.css +++ b/addons/point_of_sale/static/src/css/pos.css @@ -882,8 +882,8 @@ td { border: 1px solid #cecbcb; padding: 10px 20px; padding-left: 38px; + padding-right: 33px; margin: 6px; - background: url("../img/search.png") no-repeat 15px; background-color: white; border-radius: 20px; font-family: "Lato","Lucida Grande", Helvetica, Verdana, Arial; @@ -894,12 +894,25 @@ td { box-shadow: 0px 0px 0px 2px rgb(153, 153, 255) inset; color: rgb(153, 153, 255); } + .pos .search-clear { position: absolute; + top: 9px; width: 30px; height: 30px; - top: 11px; + display: flex; + align-items: center; + justify-content: center; +} + +.search-clear.left { left: 11px; + color: #808080; +} + +.search-clear.right { + left: 145px; + color: #808080; cursor: pointer; } diff --git a/addons/point_of_sale/static/src/img/search.png b/addons/point_of_sale/static/src/img/search.png deleted file mode 100644 index d1705e9a24ab07f65286a311cf2f41510dde7f4d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 505 zcmVPx#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FZT01FZU(%pXi00007bV*G`2ipZ1 z4Gt$_joP0800DVPL_t(2&wY?FZ`xoKMbG<;1Exa=IDtqEjs!GY=)x~x59#lPouwHK zUqpoy#VNwjxI+vvO<#v9r0LKzUg=z2UCE!H*=)CJt>rd~SSAT4$HxR`XSCaG%AP0u zg`{b!UCPJ7L7)O#bUv1Hp5P*R4Nrdb-VkL zLKH;+bUGc{trqUVfm99;)fmHaxg?4rx)&FF!K{)51%e=;D)Q~& zLBCvI^K~|R_mGI7s#K1S_$(CU+s%g6dad*MocR8p)q0Izt5L7lxxKsNN19Tt zRv8QixUMU*$udNQJkNEv+wt?|1;-eS_^7B-^L_aZ(fX_D)Rz{800000NkvXXu0mjfr7qyI diff --git a/addons/point_of_sale/static/src/js/screens.js b/addons/point_of_sale/static/src/js/screens.js index 48dbfd28b90..d5d149a02e4 100644 --- a/addons/point_of_sale/static/src/js/screens.js +++ b/addons/point_of_sale/static/src/js/screens.js @@ -811,7 +811,7 @@ var ProductCategoriesWidget = PosBaseWidget.extend({ this.el.querySelector('.searchbox input').addEventListener('keydown',this.search_handler); - this.el.querySelector('.search-clear').addEventListener('click',this.clear_search_handler); + this.el.querySelector('.search-clear.right').addEventListener('click',this.clear_search_handler); if(this.pos.config.iface_vkeyboard && this.chrome.widget.keyboard){ this.chrome.widget.keyboard.connect($(this.el.querySelector('.searchbox input'))); @@ -840,11 +840,11 @@ var ProductCategoriesWidget = PosBaseWidget.extend({ this.pos.get_order().add_product(products[0]); this.clear_search(); }else{ - this.product_list_widget.set_product_list(products); + this.product_list_widget.set_product_list(products, query); } }else{ products = this.pos.db.get_product_by_category(this.category.id); - this.product_list_widget.set_product_list(products); + this.product_list_widget.set_product_list(products, query); } }, @@ -867,6 +867,7 @@ var ProductListWidget = PosBaseWidget.extend({ this.weight = options.weight || 0; this.show_scale = options.show_scale || false; this.next_screen = options.next_screen || false; + this.search_word = false; this.click_product_handler = function(){ var product = self.pos.db.get_product_by_id(this.dataset.productId); @@ -894,8 +895,9 @@ var ProductListWidget = PosBaseWidget.extend({ this.renderElement(); }, this); }, - set_product_list: function(product_list){ + set_product_list: function(product_list, search_word){ this.product_list = product_list; + this.search_word = !!search_word ? search_word : false; this.renderElement(); }, get_product_image_url: function(product){ diff --git a/addons/point_of_sale/static/src/js/tours/point_of_sale.js b/addons/point_of_sale/static/src/js/tours/point_of_sale.js index 225809819ed..5fc69341602 100644 --- a/addons/point_of_sale/static/src/js/tours/point_of_sale.js +++ b/addons/point_of_sale/static/src/js/tours/point_of_sale.js @@ -11,12 +11,14 @@ tour.register('point_of_sale_tour', { rainbowMan: false, }, [tour.STEPS.SHOW_APPS_MENU_ITEM, { trigger: '.o_app[data-menu-xmlid="point_of_sale.menu_point_root"]', - content: _t("Ready to launch your point of sale? Click here."), + content: _t("Ready to launch your point of sale?"), + width: 215, position: 'right', edition: 'community' }, { trigger: '.o_app[data-menu-xmlid="point_of_sale.menu_point_root"]', - content: _t("Ready to launch your point of sale? Click here."), + content: _t("Ready to launch your point of sale?"), + width: 215, position: 'bottom', edition: 'enterprise' }, { diff --git a/addons/point_of_sale/static/src/xml/pos.xml b/addons/point_of_sale/static/src/xml/pos.xml index 5f381063134..3d4c2462b94 100644 --- a/addons/point_of_sale/static/src/xml/pos.xml +++ b/addons/point_of_sale/static/src/xml/pos.xml @@ -229,7 +229,12 @@ @@ -246,8 +251,20 @@
-
-
+ +
+
+
+ +
+ +

No results found for "".

+
+ +

There are no products in this category.

+
+
+
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 89cb1438f61..00327b9daba 100644 --- a/addons/point_of_sale/views/point_of_sale_dashboard.xml +++ b/addons/point_of_sale/views/point_of_sale_dashboard.xml @@ -43,6 +43,7 @@ pos.config + @@ -112,6 +113,16 @@ +
+ +