From 6a9ea9dbb283baacd7a4578f63e1de14703f96f2 Mon Sep 17 00:00:00 2001 From: Robin Heinz Date: Tue, 10 Dec 2019 10:26:34 +0000 Subject: [PATCH] [FIX] point_of_sale: Deactivate pricelist from res config. This commit prevent the use of the pricelist in the pos after deactivating the option in the res config setting. Before, the xml was not shown anymore but the option use_pricelist was still True and we could still see the pricelist in the frontend of the POS. We were unable to change the option in the backend. Now, when we untick the option in the res config setting, we disable all 'use_pricelist' in the pos configs. closes odoo/odoo#41613 Task-id: 2151669 Signed-off-by: pimodoo --- addons/point_of_sale/models/res_config_settings.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/point_of_sale/models/res_config_settings.py b/addons/point_of_sale/models/res_config_settings.py index 07b2346b75a..7bae915dd3e 100644 --- a/addons/point_of_sale/models/res_config_settings.py +++ b/addons/point_of_sale/models/res_config_settings.py @@ -10,3 +10,10 @@ class ResConfigSettings(models.TransientModel): module_pos_mercury = fields.Boolean(string="Vantiv Payment Terminal", help="The transactions are processed by Vantiv. Set your Vantiv credentials on the related payment method.") module_pos_adyen = fields.Boolean(string="Adyen Payment Terminal", help="The transactions are processed by Adyen. Set your Adyen credentials on the related payment method.") update_stock_quantities = fields.Selection(related="company_id.point_of_sale_update_stock_quantities", readonly=False) + + def set_values(self): + super(ResConfigSettings, self).set_values() + if not self.group_product_pricelist: + configs = self.env['pos.config'].search([('use_pricelist', '=', True)]) + for config in configs: + config.use_pricelist = False