[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
This commit is contained in:
committed by
Yannick Tivisse
parent
59bcb5d611
commit
4e715dae94
@@ -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")
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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 ********* */
|
||||
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
},
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
},
|
||||
|
||||
@@ -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 && !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 && 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">
|
||||
|
||||
|
||||
@@ -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" />
|
||||
|
||||
@@ -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));
|
||||
});
|
||||
|
||||
@@ -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" />
|
||||
|
||||
Reference in New Issue
Block a user