Browse Source

[REF] rename fields

pull/304/head
Sylvain LE GAL 8 years ago
parent
commit
48fd8446b6
  1. 10
      pos_access_right/demo/res_groups.yml
  2. 24
      pos_access_right/i18n/fr.po
  3. 50
      pos_access_right/models/pos_config.py
  4. 10
      pos_access_right/security/res_groups.yml
  5. 26
      pos_access_right/static/src/js/pos_access_right.js

10
pos_access_right/demo/res_groups.yml

@ -4,23 +4,23 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
- !record {model: res.groups, id: group_pos_negative_qty}:
- !record {model: res.groups, id: group_negative_qty}:
users: users:
- base.user_root - base.user_root
- !record {model: res.groups, id: group_pos_discount}:
- !record {model: res.groups, id: group_discount}:
users: users:
- base.user_root - base.user_root
- base.user_demo - base.user_demo
- !record {model: res.groups, id: group_pos_change_unit_price}:
- !record {model: res.groups, id: group_change_unit_price}:
users: users:
- base.user_root - base.user_root
- !record {model: res.groups, id: group_pos_multi_order}:
- !record {model: res.groups, id: group_multi_order}:
users: users:
- base.user_root - base.user_root
- !record {model: res.groups, id: group_pos_delete_order}:
- !record {model: res.groups, id: group_delete_order}:
users: users:
- base.user_root - base.user_root

24
pos_access_right/i18n/fr.po

@ -63,54 +63,54 @@ msgid "Please ask your manager to do it."
msgstr "Veuillez vous rapprocher d'un superviseur" msgstr "Veuillez vous rapprocher d'un superviseur"
#. module: pos_access_right #. module: pos_access_right
#: model:ir.model.fields,field_description:pos_access_right.field_pos_config_group_pos_delete_order
#: model:res.groups,name:pos_access_right.group_pos_delete_order
#: model:ir.model.fields,field_description:pos_access_right.field_pos_config_group_delete_order
#: model:res.groups,name:pos_access_right.group_delete_order
msgid "Point of Sale - Delete Order" msgid "Point of Sale - Delete Order"
msgstr "Point de Vente - Supprimer une commande" msgstr "Point de Vente - Supprimer une commande"
#. module: pos_access_right #. module: pos_access_right
#: model:res.groups,name:pos_access_right.group_pos_discount
#: model:res.groups,name:pos_access_right.group_discount
msgid "Point of Sale - Discount" msgid "Point of Sale - Discount"
msgstr "Point de Vente - Remise" msgstr "Point de Vente - Remise"
#. module: pos_access_right #. module: pos_access_right
#: model:ir.model.fields,field_description:pos_access_right.field_pos_config_group_pos_multi_order
#: model:res.groups,name:pos_access_right.group_pos_multi_order
#: model:ir.model.fields,field_description:pos_access_right.field_pos_config_group_multi_order
#: model:res.groups,name:pos_access_right.group_multi_order
msgid "Point of Sale - Many Orders" msgid "Point of Sale - Many Orders"
msgstr "Point de Vente - Plusieurs commandes simultanées" msgstr "Point de Vente - Plusieurs commandes simultanées"
#. module: pos_access_right #. module: pos_access_right
#: model:res.groups,name:pos_access_right.group_pos_negative_qty
#: model:res.groups,name:pos_access_right.group_negative_qty
msgid "Point of Sale - Negative Quantity" msgid "Point of Sale - Negative Quantity"
msgstr "Point de Vente - Quantité négative" msgstr "Point de Vente - Quantité négative"
#. module: pos_access_right #. module: pos_access_right
#: model:res.groups,name:pos_access_right.group_pos_change_unit_price
#: model:res.groups,name:pos_access_right.group_change_unit_price
msgid "Point of Sale - Unit Price Change" msgid "Point of Sale - Unit Price Change"
msgstr "Point de Vente - Changer de prix" msgstr "Point de Vente - Changer de prix"
#. module: pos_access_right #. module: pos_access_right
#: model:ir.model.fields,help:pos_access_right.field_pos_config_group_pos_discount
#: model:ir.model.fields,help:pos_access_right.field_pos_config_group_discount
msgid "This field is there to pass the id of the 'PoS - Allow Discount' Group to the Point of Sale Frontend." msgid "This field is there to pass the id of the 'PoS - Allow Discount' Group to the Point of Sale Frontend."
msgstr "The champs existe pour passer l'ID du groupe 'PdV - Autoriser les remises' au sein du point de vente tactile." msgstr "The champs existe pour passer l'ID du groupe 'PdV - Autoriser les remises' au sein du point de vente tactile."
#. module: pos_access_right #. module: pos_access_right
#: model:ir.model.fields,help:pos_access_right.field_pos_config_group_pos_negative_qty
#: model:ir.model.fields,help:pos_access_right.field_pos_config_group_negative_qty
msgid "This field is there to pass the id of the 'PoS - Allow Negative Quantity' Group to the Point of Sale Frontend." msgid "This field is there to pass the id of the 'PoS - Allow Negative Quantity' Group to the Point of Sale Frontend."
msgstr "The champs existe pour passer l'ID du groupe 'PdV - Autoriser les quantités négatives' au sein du point de vente tactile." msgstr "The champs existe pour passer l'ID du groupe 'PdV - Autoriser les quantités négatives' au sein du point de vente tactile."
#. module: pos_access_right #. module: pos_access_right
#: model:ir.model.fields,help:pos_access_right.field_pos_config_group_pos_change_unit_price
#: model:ir.model.fields,help:pos_access_right.field_pos_config_group_change_unit_price
msgid "This field is there to pass the id of the 'PoS - Allow Unit Price Change' Group to the Point of Sale Frontend." msgid "This field is there to pass the id of the 'PoS - Allow Unit Price Change' Group to the Point of Sale Frontend."
msgstr "The champs existe pour passer l'ID du groupe 'PdV - Autoriser les changements de prix' au sein du point de vente tactile." msgstr "The champs existe pour passer l'ID du groupe 'PdV - Autoriser les changements de prix' au sein du point de vente tactile."
#. module: pos_access_right #. module: pos_access_right
#: model:ir.model.fields,help:pos_access_right.field_pos_config_group_pos_delete_order
#: model:ir.model.fields,help:pos_access_right.field_pos_config_group_delete_order
msgid "This field is there to pass the id of the 'PoS - Delete Order' Group to the Point of Sale Frontend." msgid "This field is there to pass the id of the 'PoS - Delete Order' Group to the Point of Sale Frontend."
msgstr "The champs existe pour passer l'ID du groupe 'PdV - Supprimer une commande' au sein du point de vente tactile." msgstr "The champs existe pour passer l'ID du groupe 'PdV - Supprimer une commande' au sein du point de vente tactile."
#. module: pos_access_right #. module: pos_access_right
#: model:ir.model.fields,help:pos_access_right.field_pos_config_group_pos_multi_order
#: model:ir.model.fields,help:pos_access_right.field_pos_config_group_multi_order
msgid "This field is there to pass the id of the 'PoS - Many Orders Group to the Point of Sale Frontend." msgid "This field is there to pass the id of the 'PoS - Many Orders Group to the Point of Sale Frontend."
msgstr "The champs existe pour passer l'ID du groupe 'PdV - Plusieurs commandes' au sein du point de vente tactile." msgstr "The champs existe pour passer l'ID du groupe 'PdV - Plusieurs commandes' au sein du point de vente tactile."

50
pos_access_right/models/pos_config.py

@ -9,67 +9,67 @@ from openerp import fields, models, api
class PosConfig(models.Model): class PosConfig(models.Model):
_inherit = 'pos.config' _inherit = 'pos.config'
group_pos_negative_qty = fields.Many2one(
group_negative_qty_id = fields.Many2one(
comodel_name='res.groups', comodel_name='res.groups',
compute='_compute_group_pos_negative_qty',
compute='_compute_group_negative_qty_id',
string='Point of Sale - Allow Negative Quantity', string='Point of Sale - Allow Negative Quantity',
help="This field is there to pass the id of the 'PoS - Allow Negative" help="This field is there to pass the id of the 'PoS - Allow Negative"
" Quantity' Group to the Point of Sale Frontend.") " Quantity' Group to the Point of Sale Frontend.")
group_pos_discount = fields.Many2one(
group_discount_id = fields.Many2one(
comodel_name='res.groups', comodel_name='res.groups',
compute='_compute_group_pos_discount',
compute='_compute_group_discount_id',
string='Point of Sale - Allow Discount', string='Point of Sale - Allow Discount',
help="This field is there to pass the id of the 'PoS - Allow Discount'" help="This field is there to pass the id of the 'PoS - Allow Discount'"
" Group to the Point of Sale Frontend.") " Group to the Point of Sale Frontend.")
group_pos_change_unit_price = fields.Many2one(
group_change_unit_price_id = fields.Many2one(
comodel_name='res.groups', comodel_name='res.groups',
compute='_compute_group_pos_change_unit_price',
compute='_compute_group_change_unit_price_id',
string='Point of Sale - Allow Unit Price Change', string='Point of Sale - Allow Unit Price Change',
help="This field is there to pass the id of the 'PoS - Allow Unit" help="This field is there to pass the id of the 'PoS - Allow Unit"
" Price Change' Group to the Point of Sale Frontend.") " Price Change' Group to the Point of Sale Frontend.")
group_pos_multi_order = fields.Many2one(
group_multi_order_id = fields.Many2one(
comodel_name='res.groups', comodel_name='res.groups',
compute='_compute_group_pos_multi_order',
compute='_compute_group_multi_order_id',
string='Point of Sale - Many Orders', string='Point of Sale - Many Orders',
help="This field is there to pass the id of the 'PoS - Many Orders" help="This field is there to pass the id of the 'PoS - Many Orders"
" Group to the Point of Sale Frontend.") " Group to the Point of Sale Frontend.")
group_pos_delete_order = fields.Many2one(
group_delete_order_id = fields.Many2one(
comodel_name='res.groups', comodel_name='res.groups',
compute='_compute_group_pos_delete_order',
compute='_compute_group_delete_order_id',
string='Point of Sale - Delete Order', string='Point of Sale - Delete Order',
help="This field is there to pass the id of the 'PoS - Delete Order'" help="This field is there to pass the id of the 'PoS - Delete Order'"
" Group to the Point of Sale Frontend.") " Group to the Point of Sale Frontend.")
@api.multi @api.multi
def _compute_group_pos_negative_qty(self):
def _compute_group_negative_qty_id(self):
for config in self: for config in self:
self.group_pos_negative_qty = \
self.env.ref('pos_access_right.group_pos_negative_qty')
self.group_negative_qty_id = \
self.env.ref('pos_access_right.group_negative_qty')
@api.multi @api.multi
def _compute_group_pos_discount(self):
def _compute_group_discount_id(self):
for config in self: for config in self:
self.group_pos_discount = \
self.env.ref('pos_access_right.group_pos_discount')
self.group_discount_id = \
self.env.ref('pos_access_right.group_discount')
@api.multi @api.multi
def _compute_group_pos_change_unit_price(self):
def _compute_group_change_unit_price_id(self):
for config in self: for config in self:
self.group_pos_change_unit_price = \
self.env.ref('pos_access_right.group_pos_change_unit_price')
self.group_change_unit_price_id = \
self.env.ref('pos_access_right.group_change_unit_price')
@api.multi @api.multi
def _compute_group_pos_multi_order(self):
def _compute_group_multi_order_id(self):
for config in self: for config in self:
self.group_pos_multi_order = \
self.env.ref('pos_access_right.group_pos_multi_order')
self.group_multi_order_id = \
self.env.ref('pos_access_right.group_multi_order')
@api.multi @api.multi
def _compute_group_pos_delete_order(self):
def _compute_group_delete_order_id(self):
for config in self: for config in self:
self.group_pos_delete_order = \
self.env.ref('pos_access_right.group_pos_delete_order')
self.group_delete_order_id = \
self.env.ref('pos_access_right.group_delete_order')

10
pos_access_right/security/res_groups.yml

@ -4,22 +4,22 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
- !record {model: res.groups, id: group_pos_negative_qty}:
- !record {model: res.groups, id: group_negative_qty}:
name: Point of Sale - Negative Quantity name: Point of Sale - Negative Quantity
category_id: base.module_category_usability category_id: base.module_category_usability
- !record {model: res.groups, id: group_pos_discount}:
- !record {model: res.groups, id: group_discount}:
name: Point of Sale - Discount name: Point of Sale - Discount
category_id: base.module_category_usability category_id: base.module_category_usability
- !record {model: res.groups, id: group_pos_change_unit_price}:
- !record {model: res.groups, id: group_change_unit_price}:
name: Point of Sale - Unit Price Change name: Point of Sale - Unit Price Change
category_id: base.module_category_usability category_id: base.module_category_usability
- !record {model: res.groups, id: group_pos_multi_order}:
- !record {model: res.groups, id: group_multi_order}:
name: Point of Sale - Many Orders name: Point of Sale - Many Orders
category_id: base.module_category_usability category_id: base.module_category_usability
- !record {model: res.groups, id: group_pos_delete_order}:
- !record {model: res.groups, id: group_delete_order}:
name: Point of Sale - Delete Order name: Point of Sale - Delete Order
category_id: base.module_category_usability category_id: base.module_category_usability

26
pos_access_right/static/src/js/pos_access_right.js

@ -21,19 +21,19 @@ point_of_sale.gui
// New function 'display_access_right' to display disabled functions // New function 'display_access_right' to display disabled functions
gui.Gui.prototype.display_access_right = function(user){ 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'); $('.numpad-minus').removeClass('pos-disabled-mode');
} }
else{ else{
$('.numpad-minus').addClass('pos-disabled-mode'); $('.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'); $(".mode-button[data-mode='discount']").removeClass('pos-disabled-mode');
} }
else{ else{
$(".mode-button[data-mode='discount']").addClass('pos-disabled-mode'); $(".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'); $(".mode-button[data-mode='price']").removeClass('pos-disabled-mode');
} }
else{ else{
@ -47,11 +47,11 @@ point_of_sale.models
******************************************************** */ ******************************************************** */
// load extra data from 'pos_config' (ids of new groups) // 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 // Overload 'set_cashier' function to display correctly
// unauthorized function after cashier changed // unauthorized function after cashier changed
@ -67,7 +67,7 @@ chrome.OrderSelectorWidget
chrome.OrderSelectorWidget.include({ chrome.OrderSelectorWidget.include({
neworder_click_handler: function(event, $el) { 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',{ this.gui.show_popup('error',{
'title': _t('Many Orders - Unauthorized function'), 'title': _t('Many Orders - Unauthorized function'),
'body': _t('Please ask your manager to do it.'), 'body': _t('Please ask your manager to do it.'),
@ -78,7 +78,7 @@ chrome.OrderSelectorWidget
} }
}, },
deleteorder_click_handler: function(event, $el) { 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',{ this.gui.show_popup('error',{
'title': _t('Delete Order - Unauthorized function'), 'title': _t('Delete Order - Unauthorized function'),
'body': _t('Please ask your manager to do it.'), '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 // block '+/-' button if user doesn't belong to the correct group
clickSwitchSign: function() { 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',{ this.gui.show_popup('error',{
'title': _t('Negative Quantity - Unauthorized function'), 'title': _t('Negative Quantity - Unauthorized function'),
'body': _t('Please ask your manager to do it.'), '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 // 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' &&
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',{ this.gui.show_popup('error',{
'title': _t('Discount - Unauthorized function'), 'title': _t('Discount - Unauthorized function'),
'body': _t('Please ask your manager to do it.'), 'body': _t('Please ask your manager to do it.'),
}); });
} }
else if (event.currentTarget.attributes['data-mode'].nodeValue == 'price' && 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',{ this.gui.show_popup('error',{
'title': _t('Change Unit Price - Unauthorized function'), 'title': _t('Change Unit Price - Unauthorized function'),
'body': _t('Please ask your manager to do it.'), 'body': _t('Please ask your manager to do it.'),

Loading…
Cancel
Save