From 6dacb3269d06ca5b00be7612873b6c4602b52031 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 11 Sep 2018 15:04:41 +0000 Subject: [PATCH] [IMP] point_of_sale: check constraint at session creation The constraints could be bypassed if a user set a jourmal/account/location to the pos.config and, then, modifies the location configuration. Checking the value of current_session_id makes sure the constraints is triggered also when the session is created. Prevents workarounds such as explained at #26641 --- addons/point_of_sale/models/pos_config.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/point_of_sale/models/pos_config.py b/addons/point_of_sale/models/pos_config.py index ed8e4b24afa..9fde5580a30 100644 --- a/addons/point_of_sale/models/pos_config.py +++ b/addons/point_of_sale/models/pos_config.py @@ -437,6 +437,11 @@ class PosConfig(models.Model): """ self.ensure_one() if not self.current_session_id: + self._check_company_location() + self._check_company_journal() + self._check_company_invoice_journal() + self._check_company_payment() + self._check_currencies() self.current_session_id = self.env['pos.session'].create({ 'user_id': self.env.uid, 'config_id': self.id