|
@ -9,6 +9,7 @@ odoo.define('pos_access_right.pos_access_right', function (require) { |
|
|
"use strict"; |
|
|
"use strict"; |
|
|
|
|
|
|
|
|
var screens = require('point_of_sale.screens'); |
|
|
var screens = require('point_of_sale.screens'); |
|
|
|
|
|
var chrome = require('point_of_sale.chrome'); |
|
|
var models = require('point_of_sale.models'); |
|
|
var models = require('point_of_sale.models'); |
|
|
var gui = require('point_of_sale.gui'); |
|
|
var gui = require('point_of_sale.gui'); |
|
|
var core = require('web.core'); |
|
|
var core = require('web.core'); |
|
@ -38,6 +39,12 @@ point_of_sale.gui |
|
|
else{ |
|
|
else{ |
|
|
$(".mode-button[data-mode='price']").addClass('pos-disabled-mode'); |
|
|
$(".mode-button[data-mode='price']").addClass('pos-disabled-mode'); |
|
|
} |
|
|
} |
|
|
|
|
|
if (user.groups_id.indexOf(this.pos.config.group_pos_multi_order[0]) != -1){ |
|
|
|
|
|
$('.neworder-button').removeClass('pos-disabled-mode'); |
|
|
|
|
|
} |
|
|
|
|
|
else{ |
|
|
|
|
|
$('.neworder-button').addClass('pos-disabled-mode'); |
|
|
|
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -49,6 +56,9 @@ point_of_sale.models |
|
|
models.load_fields("pos.config", "group_pos_negative_qty"); |
|
|
models.load_fields("pos.config", "group_pos_negative_qty"); |
|
|
models.load_fields("pos.config", "group_pos_discount"); |
|
|
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_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_pos_delete_order_line"); |
|
|
|
|
|
|
|
|
// Overload 'set_cashier' function to display correctly
|
|
|
// Overload 'set_cashier' function to display correctly
|
|
|
// unauthorized function after cashier changed
|
|
|
// unauthorized function after cashier changed
|
|
@ -58,6 +68,35 @@ point_of_sale.models |
|
|
_set_cashier_.call(this, user); |
|
|
_set_cashier_.call(this, user); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/* ******************************************************** |
|
|
|
|
|
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) { |
|
|
|
|
|
this.gui.show_popup('error',{ |
|
|
|
|
|
'title': _t('Negative Quantity - Unauthorized function'), |
|
|
|
|
|
'body': _t('Please ask your manager to do it.'), |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
return this._super(); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
deleteorder_click_handler: function(event, $el) { |
|
|
|
|
|
if (this.pos.get_cashier().groups_id.indexOf(this.pos.config.group_pos_delete_order[0]) == -1) { |
|
|
|
|
|
this.gui.show_popup('error',{ |
|
|
|
|
|
'title': _t('Delete Order - Unauthorized function'), |
|
|
|
|
|
'body': _t('Please ask your manager to do it.'), |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
return this._super(); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* ******************************************************** |
|
|
/* ******************************************************** |
|
|
screens.NumpadWidget |
|
|
screens.NumpadWidget |
|
@ -84,6 +123,19 @@ screens.NumpadWidget |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// block '+/-' button if user doesn't belong to the correct group
|
|
|
|
|
|
clickDeleteLastChar: function() { |
|
|
|
|
|
if (this.pos.get_cashier().groups_id.indexOf(this.pos.config.group_pos_delete_order_line[0]) == -1) { |
|
|
|
|
|
this.gui.show_popup('error',{ |
|
|
|
|
|
'title': _t('Delete Order Line - Unauthorized function'), |
|
|
|
|
|
'body': _t('Please ask your manager to do it.'), |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
return this._super(); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
// block 'discount' or 'price' button if user doesn't belong to the correct group
|
|
|
// block 'discount' or 'price' button if user doesn't belong to the correct group
|
|
|
clickChangeMode: function(event) { |
|
|
clickChangeMode: function(event) { |
|
|
if (event.currentTarget.attributes['data-mode'].nodeValue == 'discount' && |
|
|
if (event.currentTarget.attributes['data-mode'].nodeValue == 'discount' && |
|
|