|
|
@ -21,19 +21,19 @@ point_of_sale.gui |
|
|
|
|
|
|
|
// New function 'display_access_right' to display disabled functions
|
|
|
|
gui.Gui.prototype.display_access_right = function(user){ |
|
|
|
if (user.groups_id.indexOf(this.pos.config.group_pos_negative_qty[0]) != -1){ |
|
|
|
if (user.groups_id.indexOf(this.pos.config.group_negative_qty_id[0]) != -1){ |
|
|
|
$('.numpad-minus').removeClass('pos-disabled-mode'); |
|
|
|
} |
|
|
|
else{ |
|
|
|
$('.numpad-minus').addClass('pos-disabled-mode'); |
|
|
|
} |
|
|
|
if (user.groups_id.indexOf(this.pos.config.group_pos_discount[0]) != -1){ |
|
|
|
if (user.groups_id.indexOf(this.pos.config.group_discount_id[0]) != -1){ |
|
|
|
$(".mode-button[data-mode='discount']").removeClass('pos-disabled-mode'); |
|
|
|
} |
|
|
|
else{ |
|
|
|
$(".mode-button[data-mode='discount']").addClass('pos-disabled-mode'); |
|
|
|
} |
|
|
|
if (user.groups_id.indexOf(this.pos.config.group_pos_change_unit_price[0]) != -1){ |
|
|
|
if (user.groups_id.indexOf(this.pos.config.group_change_unit_price_id[0]) != -1){ |
|
|
|
$(".mode-button[data-mode='price']").removeClass('pos-disabled-mode'); |
|
|
|
} |
|
|
|
else{ |
|
|
@ -47,11 +47,11 @@ point_of_sale.models |
|
|
|
******************************************************** */ |
|
|
|
|
|
|
|
// load extra data from 'pos_config' (ids of new groups)
|
|
|
|
models.load_fields("pos.config", "group_pos_negative_qty"); |
|
|
|
models.load_fields("pos.config", "group_pos_discount"); |
|
|
|
models.load_fields("pos.config", "group_pos_change_unit_price"); |
|
|
|
models.load_fields("pos.config", "group_pos_multi_order"); |
|
|
|
models.load_fields("pos.config", "group_pos_delete_order"); |
|
|
|
models.load_fields("pos.config", "group_negative_qty_id"); |
|
|
|
models.load_fields("pos.config", "group_discount_id"); |
|
|
|
models.load_fields("pos.config", "group_change_unit_price_id"); |
|
|
|
models.load_fields("pos.config", "group_multi_order_id"); |
|
|
|
models.load_fields("pos.config", "group_delete_order_id"); |
|
|
|
|
|
|
|
// Overload 'set_cashier' function to display correctly
|
|
|
|
// unauthorized function after cashier changed
|
|
|
@ -67,7 +67,7 @@ chrome.OrderSelectorWidget |
|
|
|
chrome.OrderSelectorWidget.include({ |
|
|
|
|
|
|
|
neworder_click_handler: function(event, $el) { |
|
|
|
if (this.pos.get_cashier().groups_id.indexOf(this.pos.config.group_pos_multi_order[0]) == -1) { |
|
|
|
if (this.pos.get_cashier().groups_id.indexOf(this.pos.config.group_multi_order_id[0]) == -1) { |
|
|
|
this.gui.show_popup('error',{ |
|
|
|
'title': _t('Many Orders - Unauthorized function'), |
|
|
|
'body': _t('Please ask your manager to do it.'), |
|
|
@ -78,7 +78,7 @@ chrome.OrderSelectorWidget |
|
|
|
} |
|
|
|
}, |
|
|
|
deleteorder_click_handler: function(event, $el) { |
|
|
|
if (this.pos.get_cashier().groups_id.indexOf(this.pos.config.group_pos_delete_order[0]) == -1) { |
|
|
|
if (this.pos.get_cashier().groups_id.indexOf(this.pos.config.group_delete_order_id[0]) == -1) { |
|
|
|
this.gui.show_popup('error',{ |
|
|
|
'title': _t('Delete Order - Unauthorized function'), |
|
|
|
'body': _t('Please ask your manager to do it.'), |
|
|
@ -105,7 +105,7 @@ screens.NumpadWidget |
|
|
|
|
|
|
|
// block '+/-' button if user doesn't belong to the correct group
|
|
|
|
clickSwitchSign: function() { |
|
|
|
if (this.pos.get_cashier().groups_id.indexOf(this.pos.config.group_pos_negative_qty[0]) == -1) { |
|
|
|
if (this.pos.get_cashier().groups_id.indexOf(this.pos.config.group_negative_qty_id[0]) == -1) { |
|
|
|
this.gui.show_popup('error',{ |
|
|
|
'title': _t('Negative Quantity - Unauthorized function'), |
|
|
|
'body': _t('Please ask your manager to do it.'), |
|
|
@ -119,14 +119,14 @@ screens.NumpadWidget |
|
|
|
// block 'discount' or 'price' button if user doesn't belong to the correct group
|
|
|
|
clickChangeMode: function(event) { |
|
|
|
if (event.currentTarget.attributes['data-mode'].nodeValue == 'discount' && |
|
|
|
this.pos.get_cashier().groups_id.indexOf(this.pos.config.group_pos_discount[0]) == -1) { |
|
|
|
this.pos.get_cashier().groups_id.indexOf(this.pos.config.group_discount_id[0]) == -1) { |
|
|
|
this.gui.show_popup('error',{ |
|
|
|
'title': _t('Discount - Unauthorized function'), |
|
|
|
'body': _t('Please ask your manager to do it.'), |
|
|
|
}); |
|
|
|
} |
|
|
|
else if (event.currentTarget.attributes['data-mode'].nodeValue == 'price' && |
|
|
|
this.pos.get_cashier().groups_id.indexOf(this.pos.config.group_pos_change_unit_price[0]) == -1) { |
|
|
|
this.pos.get_cashier().groups_id.indexOf(this.pos.config.group_change_unit_price_id[0]) == -1) { |
|
|
|
this.gui.show_popup('error',{ |
|
|
|
'title': _t('Change Unit Price - Unauthorized function'), |
|
|
|
'body': _t('Please ask your manager to do it.'), |
|
|
|