summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKishan Gajjar <kig@odoo.com>2017-02-20 11:45:08 +0530
committerYannick Tivisse <yti@odoo.com>2017-05-15 17:43:15 +0200
commit4e715dae94dc956dbfacfe3974f42ade86ad2c2a (patch)
tree2a549bcc1b0acd86ab1d9377c248bf0cf5ba502c
parent59bcb5d611a92f4c6a2da1524080eae53e7d1b52 (diff)
[IMP] point_of_sale(_restaurant): Add some small UX improvements
[IMP] point_of_sale: Improve `New Session` button label if already opened When another user has a POS session open. Do not show the New Sesson button on the dashboard. Hide it and replace it by the string 'A session is already opened' [IMP] pos_restaurant: Move some technical fields in debug mode [IMP] point_of_sale: Remove tooltip for barcode [IMP] point_of_sale: All to restict product price control to managers Either: - Everybody - Only managers should be able to modify the product price on orders for a given point of sale [IMP] pos_restaurant: Exit table edit mode via 'ESC' button of keyboard
-rw-r--r--addons/point_of_sale/models/pos_config.py2
-rw-r--r--addons/point_of_sale/models/pos_session.py2
-rw-r--r--addons/point_of_sale/models/res_partner.py2
-rw-r--r--addons/point_of_sale/static/src/css/pos.css5
-rw-r--r--addons/point_of_sale/static/src/js/chrome.js1
-rw-r--r--addons/point_of_sale/static/src/js/models.js3
-rw-r--r--addons/point_of_sale/static/src/js/screens.js5
-rw-r--r--addons/point_of_sale/views/point_of_sale_dashboard.xml5
-rw-r--r--addons/point_of_sale/views/pos_config_view.xml1
-rw-r--r--addons/pos_restaurant/static/src/js/floors.js8
-rw-r--r--addons/pos_restaurant/views/pos_restaurant_views.xml4
11 files changed, 33 insertions, 5 deletions
diff --git a/addons/point_of_sale/models/pos_config.py b/addons/point_of_sale/models/pos_config.py
index 355c35d6ca5..05259bd89a3 100644
--- a/addons/point_of_sale/models/pos_config.py
+++ b/addons/point_of_sale/models/pos_config.py
@@ -98,6 +98,8 @@ class PosConfig(models.Model):
help='The point of sale will display this product category by default. If no category is specified, all available products will be shown')
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',
+ help="Check to box to restrict the price control to managers only on point of sale orders.")
cash_control = fields.Boolean(string='Cash Control', help="Check the amount of the cashbox at opening and closing.")
receipt_header = fields.Text(string='Receipt Header', help="A short text that will be inserted as a header in the printed receipt")
receipt_footer = fields.Text(string='Receipt Footer', help="A short text that will be inserted as a footer in the printed receipt")
diff --git a/addons/point_of_sale/models/pos_session.py b/addons/point_of_sale/models/pos_session.py
index 34f57c0998f..09400db3f46 100644
--- a/addons/point_of_sale/models/pos_session.py
+++ b/addons/point_of_sale/models/pos_session.py
@@ -155,7 +155,7 @@ class PosSession(models.Model):
('config_id', '=', self.config_id.id),
('rescue', '=', False)
]) > 1:
- raise ValidationError(_("You cannot create two active sessions related to the same point of sale!"))
+ raise ValidationError(_("Another session is already opened for this point of sale."))
@api.model
def create(self, values):
diff --git a/addons/point_of_sale/models/res_partner.py b/addons/point_of_sale/models/res_partner.py
index 238fdbdeb8e..8ac23e6bf1a 100644
--- a/addons/point_of_sale/models/res_partner.py
+++ b/addons/point_of_sale/models/res_partner.py
@@ -6,7 +6,7 @@ from odoo import api, fields, models
class ResPartner(models.Model):
_inherit = 'res.partner'
- barcode = fields.Char(string='Barcode', help="BarCode", oldname='ean13')
+ barcode = fields.Char(string='Barcode', oldname='ean13')
pos_order_count = fields.Integer(
compute='_compute_pos_order',
help="The number of point of sales orders related to this customer",
diff --git a/addons/point_of_sale/static/src/css/pos.css b/addons/point_of_sale/static/src/css/pos.css
index 5076972a3e5..a07f7eb85e0 100644
--- a/addons/point_of_sale/static/src/css/pos.css
+++ b/addons/point_of_sale/static/src/css/pos.css
@@ -771,6 +771,11 @@ td {
color: white;
border-color: transparent;
}
+.pos .numpad .disabled-mode, .pos .numpad .disabled-mode:hover {
+ background: #c7c7c7;
+ color: #a5a1a1;
+ cursor: not-allowed;
+}
/* ********* The right pane contains the screens and headers ********* */
diff --git a/addons/point_of_sale/static/src/js/chrome.js b/addons/point_of_sale/static/src/js/chrome.js
index fe16f0bfa48..96f0e8df585 100644
--- a/addons/point_of_sale/static/src/js/chrome.js
+++ b/addons/point_of_sale/static/src/js/chrome.js
@@ -103,6 +103,7 @@ var UsernameWidget = PosBaseWidget.extend({
'title': _t('Change Cashier'),
}).then(function(user){
self.pos.set_cashier(user);
+ self.pos.gui.screen_instances.products.numpad.check_price_control_rights();
self.renderElement();
});
},
diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js
index 846f1af339e..ff336551bab 100644
--- a/addons/point_of_sale/static/src/js/models.js
+++ b/addons/point_of_sale/static/src/js/models.js
@@ -1429,6 +1429,9 @@ exports.Orderline = Backbone.Model.extend({
},
// changes the base price of the product for this orderline
set_unit_price: function(price){
+ if (!this.pos.config.restrict_price_control || this.pos.get_cashier().role == 'manager') {
+ return;
+ }
this.order.assert_editable();
this.price = round_di(parseFloat(price) || 0, this.pos.dp['Product Price']);
this.trigger('change',this);
diff --git a/addons/point_of_sale/static/src/js/screens.js b/addons/point_of_sale/static/src/js/screens.js
index cc7b9f7506d..e053264277b 100644
--- a/addons/point_of_sale/static/src/js/screens.js
+++ b/addons/point_of_sale/static/src/js/screens.js
@@ -364,6 +364,7 @@ var NumpadWidget = PosBaseWidget.extend({
this.state = new models.NumpadState();
},
start: function() {
+ this.check_price_control_rights();
this.state.bind('change:mode', this.changedMode, this);
this.changedMode();
this.$el.find('.numpad-backspace').click(_.bind(this.clickDeleteLastChar, this));
@@ -371,6 +372,10 @@ var NumpadWidget = PosBaseWidget.extend({
this.$el.find('.number-char').click(_.bind(this.clickAppendNewChar, this));
this.$el.find('.mode-button').click(_.bind(this.clickChangeMode, this));
},
+ check_price_control_rights: function() {
+ var has_rights = !this.pos.config.restrict_price_control || this.pos.get_cashier().role == 'manager';
+ this.$el.find('.mode-button[data-mode="price"]').toggleClass('disabled-mode', !has_rights).prop('disabled', !has_rights);
+ },
clickDeleteLastChar: function() {
return this.state.deleteLastChar();
},
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 496f1d15ac7..740262212f5 100644
--- a/addons/point_of_sale/views/point_of_sale_dashboard.xml
+++ b/addons/point_of_sale/views/point_of_sale_dashboard.xml
@@ -73,7 +73,10 @@
<button t-if="record.current_session_state.raw_value === 'opening_control'" class="btn btn-primary" name="open_existing_session_cb" type="object">Open Session</button>
<button t-if="_.contains(['opened', 'closing_control'], record.current_session_state.raw_value)" class="btn btn-default" name="open_existing_session_cb" type="object">Close</button>
- <button t-if="!record.current_session_id.raw_value" class="btn btn-primary" name="open_session_cb" type="object">New Session</button>
+
+ <button t-if="!record.current_session_id.raw_value &amp;&amp; !record.pos_session_username.value" class="btn btn-primary" name="open_session_cb" type="object">New Session</button>
+
+ <button t-if="!record.current_session_id.raw_value &amp;&amp; record.pos_session_username.value" class="btn btn-primary" name="open_session_cb" type="object">A session is already opened</button>
</div>
<div class="col-xs-6 o_kanban_primary_right">
diff --git a/addons/point_of_sale/views/pos_config_view.xml b/addons/point_of_sale/views/pos_config_view.xml
index 77df7026c8c..31c7e0526dc 100644
--- a/addons/point_of_sale/views/pos_config_view.xml
+++ b/addons/point_of_sale/views/pos_config_view.xml
@@ -39,6 +39,7 @@
<field name="iface_start_categ_id" />
<field name="tip_product_id" />
<field name="iface_tax_included" />
+ <field name="restrict_price_control" />
</group>
<group>
<field name="iface_big_scrollbars" />
diff --git a/addons/pos_restaurant/static/src/js/floors.js b/addons/pos_restaurant/static/src/js/floors.js
index 2494401ff00..e22cb8e3bde 100644
--- a/addons/pos_restaurant/static/src/js/floors.js
+++ b/addons/pos_restaurant/static/src/js/floors.js
@@ -640,6 +640,14 @@ var FloorScreenWidget = screens.ScreenWidget.extend({
this.table_widgets.push(tw);
}
+ $('body').on('keyup', function (event) {
+ if (event.which === $.ui.keyCode.ESCAPE) {
+ if(self.editing) {
+ self.toggle_editing();
+ }
+ }
+ });
+
this.$('.floor-selector .button').click(function(event){
self.click_floor_button(event,$(this));
});
diff --git a/addons/pos_restaurant/views/pos_restaurant_views.xml b/addons/pos_restaurant/views/pos_restaurant_views.xml
index 390417a019d..7f2719f3234 100644
--- a/addons/pos_restaurant/views/pos_restaurant_views.xml
+++ b/addons/pos_restaurant/views/pos_restaurant_views.xml
@@ -11,7 +11,7 @@
<group col="4">
<field name="name" />
<field name="pos_config_id" />
- <field name="background_color" />
+ <field name="background_color" groups="base.group_no_one" />
</group>
<field name="table_ids">
<tree string='Tables'>
@@ -81,7 +81,7 @@
<field name="name" />
<field name="seats" />
</group>
- <group col="4" string="Appearance">
+ <group col="4" string="Appearance" groups="base.group_no_one">
<field name="shape" />
<field name="color" />
<field name="position_h" />