From 74e185cfe1a06b9b74a1e96481b4cc405b8a0c00 Mon Sep 17 00:00:00 2001 From: lejeune quentin Date: Mon, 11 Oct 2021 12:10:48 +0000 Subject: [PATCH] [IMP] point_of_sale: Authorizes the uses of POS in HTTPS with direct devices To avoid the use of certificates when using direct devices POS was redirected in HTTP With new Chrome or Edge security measures this is no longer possible. We add here the possibility to choose to redirect the POS in https by adding a specific key in the parameters closes odoo/odoo#78247 X-original-commit: 9cecb3bdbf5679b6d1d18dc2a250c86118bca6ce Signed-off-by: Quentin Lejeune (qle) --- addons/point_of_sale/models/pos_config.py | 3 ++- addons/pos_restaurant/models/pos_config.py | 3 ++- addons/pos_six/models/pos_config.py | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/addons/point_of_sale/models/pos_config.py b/addons/point_of_sale/models/pos_config.py index 97c092a0f5b..7863ebf8074 100644 --- a/addons/point_of_sale/models/pos_config.py +++ b/addons/point_of_sale/models/pos_config.py @@ -524,7 +524,8 @@ class PosConfig(models.Model): } def _force_http(self): - if self.other_devices: + enforce_https = self.env['ir.config_parameter'].sudo().get_param('point_of_sale.enforce_https') + if not enforce_https and self.other_devices: return True return False diff --git a/addons/pos_restaurant/models/pos_config.py b/addons/pos_restaurant/models/pos_config.py index 5cf73f6677e..3fc5e4e071b 100644 --- a/addons/pos_restaurant/models/pos_config.py +++ b/addons/pos_restaurant/models/pos_config.py @@ -32,7 +32,8 @@ class PosConfig(models.Model): self.set_tip_after_payment = False def _force_http(self): - if self.printer_ids.filtered(lambda pt: pt.printer_type == 'epson_epos'): + enforce_https = self.env['ir.config_parameter'].sudo().get_param('point_of_sale.enforce_https') + if not enforce_https and self.printer_ids.filtered(lambda pt: pt.printer_type == 'epson_epos'): return True return super(PosConfig, self)._force_http() diff --git a/addons/pos_six/models/pos_config.py b/addons/pos_six/models/pos_config.py index 6d986b2d3ab..2b7a9ea5ea3 100644 --- a/addons/pos_six/models/pos_config.py +++ b/addons/pos_six/models/pos_config.py @@ -8,6 +8,7 @@ class PosConfig(models.Model): _inherit = 'pos.config' def _force_http(self): - if self.payment_method_ids.filtered(lambda pm: pm.use_payment_terminal == 'six'): + enforce_https = self.env['ir.config_parameter'].sudo().get_param('point_of_sale.enforce_https') + if not enforce_https and self.payment_method_ids.filtered(lambda pm: pm.use_payment_terminal == 'six'): return True return super(PosConfig, self)._force_http()