diff --git a/addons/point_of_sale/models/pos_config.py b/addons/point_of_sale/models/pos_config.py index 0820787f879..28e10b047fc 100644 --- a/addons/point_of_sale/models/pos_config.py +++ b/addons/point_of_sale/models/pos_config.py @@ -218,6 +218,7 @@ class PosConfig(models.Model): only_round_cash_method = fields.Boolean(string="Only apply rounding on cash") has_active_session = fields.Boolean(compute='_compute_current_session') show_allow_invoicing_alert = fields.Boolean(compute="_compute_show_allow_invoicing_alert") + manual_discount = fields.Boolean(string="Manual Discounts", default=True) @api.depends('use_pricelist', 'available_pricelist_ids') def _compute_allowed_pricelist_ids(self): @@ -634,7 +635,7 @@ class PosConfig(models.Model): def setup_defaults(self, company): """Extend this method to customize the existing pos.config of the company during the installation of a localisation. - + :param self pos.config: pos.config records present in the company during the installation of localisation. :param company res.company: the single company where the pos.config defaults will be setup. """ diff --git a/addons/point_of_sale/static/src/js/Screens/ProductScreen/NumpadWidget.js b/addons/point_of_sale/static/src/js/Screens/ProductScreen/NumpadWidget.js index 6feda10ec9a..c15c9e5f6d0 100644 --- a/addons/point_of_sale/static/src/js/Screens/ProductScreen/NumpadWidget.js +++ b/addons/point_of_sale/static/src/js/Screens/ProductScreen/NumpadWidget.js @@ -28,10 +28,16 @@ odoo.define('point_of_sale.NumpadWidget', function(require) { const cashier = this.env.pos.get('cashier') || this.env.pos.get_cashier(); return !this.env.pos.config.restrict_price_control || cashier.role == 'manager'; } + get hasManualDiscount() { + return this.env.pos.config.manual_discount; + } changeMode(mode) { if (!this.hasPriceControlRights && mode === 'price') { return; } + if (!this.hasManualDiscount && mode === 'discount') { + return; + } this.state.mode = mode; this.trigger('set-numpad-mode', { mode }); } diff --git a/addons/point_of_sale/static/src/xml/Screens/ProductScreen/NumpadWidget.xml b/addons/point_of_sale/static/src/xml/Screens/ProductScreen/NumpadWidget.xml index e1affd63dee..d469905cced 100644 --- a/addons/point_of_sale/static/src/xml/Screens/ProductScreen/NumpadWidget.xml +++ b/addons/point_of_sale/static/src/xml/Screens/ProductScreen/NumpadWidget.xml @@ -12,7 +12,11 @@ -
diff --git a/addons/point_of_sale/static/tests/unit/test_ProductScreen.js b/addons/point_of_sale/static/tests/unit/test_ProductScreen.js index afdebb9d1cd..042048c72eb 100644 --- a/addons/point_of_sale/static/tests/unit/test_ProductScreen.js +++ b/addons/point_of_sale/static/tests/unit/test_ProductScreen.js @@ -93,6 +93,7 @@ odoo.define('point_of_sale.tests.ProductScreen', function (require) { // set dummy values in pos.config and pos.get('cashier') pos.config = { restrict_price_control: false, + manual_discount: true }; pos.set('cashier', { role: 'manager' }); diff --git a/addons/point_of_sale/views/pos_config_view.xml b/addons/point_of_sale/views/pos_config_view.xml index 572786b33ee..0400e6e4e91 100644 --- a/addons/point_of_sale/views/pos_config_view.xml +++ b/addons/point_of_sale/views/pos_config_view.xml @@ -328,6 +328,17 @@ +
+
+ +
+
+
+