From 0801ec1a350951b1d4e7d5d7b10de7ce4df6a76c Mon Sep 17 00:00:00 2001 From: oco-odoo Date: Mon, 23 Jan 2023 13:30:52 +0000 Subject: [PATCH] [IMP] account: add SQL constraint to prevent having a 'domain' expression without subformula This constraint was already implicit (the reports failed to open when this was not respected, and the view ensured it wasn't possible not to respect it). We just enforce it more. closes odoo/odoo#110718 Signed-off-by: John Laterre (jol) --- addons/account/models/account_report.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/addons/account/models/account_report.py b/addons/account/models/account_report.py index 3bdf9484337..47606a38bcd 100644 --- a/addons/account/models/account_report.py +++ b/addons/account/models/account_report.py @@ -438,6 +438,12 @@ class AccountReportExpression(models.Model): " in case the carryover destination requires more complex logic." ) + _sql_constraints = [( + "domain_engine_subformula_required", + "CHECK(engine != 'domain' OR subformula IS NOT NULL)", + "Expressions using 'domain' engine should all have a subformula." + )] + @api.depends('engine') def _compute_auditable(self): auditable_engines = self._get_auditable_engines()