From 687b0dc5e7c7d17767d6ed51b35f6f37fbc92716 Mon Sep 17 00:00:00 2001 From: Sylvain LE GAL Date: Wed, 2 Nov 2016 12:28:21 +0100 Subject: [PATCH] [REF] rename fields --- pos_access_right/demo/res_groups.yml | 10 ++-- pos_access_right/i18n/fr.po | 24 ++++----- pos_access_right/models/pos_config.py | 50 +++++++++---------- pos_access_right/security/res_groups.yml | 10 ++-- .../static/src/js/pos_access_right.js | 26 +++++----- 5 files changed, 60 insertions(+), 60 deletions(-) diff --git a/pos_access_right/demo/res_groups.yml b/pos_access_right/demo/res_groups.yml index d4bf70bc..fd74b5ec 100644 --- a/pos_access_right/demo/res_groups.yml +++ b/pos_access_right/demo/res_groups.yml @@ -4,23 +4,23 @@ # 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: - base.user_root -- !record {model: res.groups, id: group_pos_discount}: +- !record {model: res.groups, id: group_discount}: users: - base.user_root - base.user_demo -- !record {model: res.groups, id: group_pos_change_unit_price}: +- !record {model: res.groups, id: group_change_unit_price}: users: - base.user_root -- !record {model: res.groups, id: group_pos_multi_order}: +- !record {model: res.groups, id: group_multi_order}: users: - base.user_root -- !record {model: res.groups, id: group_pos_delete_order}: +- !record {model: res.groups, id: group_delete_order}: users: - base.user_root diff --git a/pos_access_right/i18n/fr.po b/pos_access_right/i18n/fr.po index f51dc4b4..c1b1d913 100644 --- a/pos_access_right/i18n/fr.po +++ b/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" #. 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" msgstr "Point de Vente - Supprimer une commande" #. 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" msgstr "Point de Vente - Remise" #. 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" msgstr "Point de Vente - Plusieurs commandes simultanées" #. 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" msgstr "Point de Vente - Quantité négative" #. 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" msgstr "Point de Vente - Changer de prix" #. 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." 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 -#: 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." 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 -#: 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." 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 -#: 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." 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 -#: 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." msgstr "The champs existe pour passer l'ID du groupe 'PdV - Plusieurs commandes' au sein du point de vente tactile." diff --git a/pos_access_right/models/pos_config.py b/pos_access_right/models/pos_config.py index 9b79ea09..be39876c 100644 --- a/pos_access_right/models/pos_config.py +++ b/pos_access_right/models/pos_config.py @@ -9,67 +9,67 @@ from openerp import fields, models, api class PosConfig(models.Model): _inherit = 'pos.config' - group_pos_negative_qty = fields.Many2one( + group_negative_qty_id = fields.Many2one( comodel_name='res.groups', - compute='_compute_group_pos_negative_qty', + compute='_compute_group_negative_qty_id', string='Point of Sale - Allow Negative Quantity', help="This field is there to pass the id of the 'PoS - Allow Negative" " Quantity' Group to the Point of Sale Frontend.") - group_pos_discount = fields.Many2one( + group_discount_id = fields.Many2one( comodel_name='res.groups', - compute='_compute_group_pos_discount', + compute='_compute_group_discount_id', string='Point of Sale - Allow Discount', help="This field is there to pass the id of the 'PoS - Allow Discount'" " 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', - compute='_compute_group_pos_change_unit_price', + compute='_compute_group_change_unit_price_id', string='Point of Sale - Allow Unit Price Change', help="This field is there to pass the id of the 'PoS - Allow Unit" " 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', - compute='_compute_group_pos_multi_order', + compute='_compute_group_multi_order_id', string='Point of Sale - Many Orders', help="This field is there to pass the id of the 'PoS - Many Orders" " Group to the Point of Sale Frontend.") - group_pos_delete_order = fields.Many2one( + group_delete_order_id = fields.Many2one( comodel_name='res.groups', - compute='_compute_group_pos_delete_order', + compute='_compute_group_delete_order_id', string='Point of Sale - Delete Order', help="This field is there to pass the id of the 'PoS - Delete Order'" " Group to the Point of Sale Frontend.") @api.multi - def _compute_group_pos_negative_qty(self): + def _compute_group_negative_qty_id(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 - def _compute_group_pos_discount(self): + def _compute_group_discount_id(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 - def _compute_group_pos_change_unit_price(self): + def _compute_group_change_unit_price_id(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 - def _compute_group_pos_multi_order(self): + def _compute_group_multi_order_id(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 - def _compute_group_pos_delete_order(self): + def _compute_group_delete_order_id(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') diff --git a/pos_access_right/security/res_groups.yml b/pos_access_right/security/res_groups.yml index e46e352b..3813e4e8 100644 --- a/pos_access_right/security/res_groups.yml +++ b/pos_access_right/security/res_groups.yml @@ -4,22 +4,22 @@ # 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 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 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 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 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 category_id: base.module_category_usability diff --git a/pos_access_right/static/src/js/pos_access_right.js b/pos_access_right/static/src/js/pos_access_right.js index be7fb225..2781c888 100644 --- a/pos_access_right/static/src/js/pos_access_right.js +++ b/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 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.'),