[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) <jol@odoo.com>
This commit is contained in:
oco-odoo
2023-01-23 20:27:14 +01:00
parent eac433de8b
commit 0801ec1a35
+6
View File
@@ -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()