Skip to content

Commit

Permalink
[FIX] website: delete page on cascade when deleting a website
Browse files Browse the repository at this point in the history
The user is never able to delete a website, since there is at least one page,
the homepage, which is bootstraped during website creation.
From that point, even if nothing was done on that website, it was not possible
to remove it.
As website deletion is already a technical thing (debug mode), and since
website.page do not make sense without their website, removing those on cascade
will allow the user to remove a non-modified website.

task-2092845

closes odoo#44957

Signed-off-by: Romain Derie <[email protected]>
  • Loading branch information
rdeodoo committed Feb 10, 2020
1 parent 835d120 commit ba6206b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion addons/website/models/website_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Page(models.Model):
header_color = fields.Char()

# don't use mixin website_id but use website_id on ir.ui.view instead
website_id = fields.Many2one(related='view_id.website_id', store=True, readonly=False)
website_id = fields.Many2one(related='view_id.website_id', store=True, readonly=False, ondelete='cascade')
arch = fields.Text(related='view_id.arch', readonly=False, depends_context=('website_id',))

def _compute_homepage(self):
Expand Down

0 comments on commit ba6206b

Please sign in to comment.