From 5e4c1b370123dee4e6d6a91cd9582ba41c4d8bd4 Mon Sep 17 00:00:00 2001 From: Nans Lefebvre Date: Mon, 22 Jul 2019 14:31:58 +0000 Subject: [PATCH] [FIX] point_of_sale: check constraints before opening POS session Set up the POS config to use a default pricelist that is archived. Open a new POS session. The constraints are checked, and an exception is raised: "The default pricelist must be included in the available pricelists." However, if the session is already opened, the check is not done at resume. If the pricelist is archived, the session fails to load entirely: after loading phase, the screen turns black and nothing happens. Since the constraints are really useful to load the POS, we trigger an explicit check of all constraints (there are a lot more than our example) when opening the POS. opw 2033453 closes odoo/odoo#35077 Signed-off-by: Richard Mathot (rim) --- addons/point_of_sale/models/pos_config.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/point_of_sale/models/pos_config.py b/addons/point_of_sale/models/pos_config.py index dfaf7121f38..9bd3afab1fc 100644 --- a/addons/point_of_sale/models/pos_config.py +++ b/addons/point_of_sale/models/pos_config.py @@ -423,6 +423,8 @@ class PosConfig(models.Model): def open_ui(self): """ open the pos interface """ self.ensure_one() + # check all constraints, raises if any is not met + self._validate_fields(self._fields) return { 'type': 'ir.actions.act_url', 'url': '/pos/web/',