From bfc296298cb7055b7e1cc09ed2f72936e0150a38 Mon Sep 17 00:00:00 2001 From: Denis Leemann Date: Tue, 14 Nov 2023 16:37:07 +0100 Subject: [PATCH] [16.0][FIX][bi_sql_editor] unlink bi_sql_view without cron Forward port of https://github.com/OCA/reporting-engine/pull/811 --- bi_sql_editor/models/bi_sql_view.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bi_sql_editor/models/bi_sql_view.py b/bi_sql_editor/models/bi_sql_view.py index 4b3463fa7c..53026da224 100644 --- a/bi_sql_editor/models/bi_sql_view.py +++ b/bi_sql_editor/models/bi_sql_view.py @@ -156,6 +156,7 @@ class BiSQLView(models.Model): comodel_name="ir.cron", readonly=True, help="Cron Task that will refresh the materialized view", + ondelete="cascade", ) rule_id = fields.Many2one(string="Odoo Rule", comodel_name="ir.rule", readonly=True) @@ -263,8 +264,6 @@ def unlink(self): "If you want to delete them, first set them to draft." ) ) - if self.cron_id: - self.cron_id.unlink() return super().unlink() def copy(self, default=None):