[FIX] website_sale: delete child category on parent

In the case of deletion with `ondelete="set null"`, return_path of
children of deleted record will not have return_path updated.

So remove the children recursively.

Another fix was done in 13.0 to avoid most issue in 6d5cd8b1d19.

opw-2148046
closes #41075

closes odoo/odoo#41178

X-original-commit: 6d5cd8b1d194fb173c486355c89d2ce503fd0ba4
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
This commit is contained in:
Nicolas Lempereur
2019-12-02 14:29:21 +00:00
parent 22b9343c9a
commit aff4b58c1f
+1 -1
View File
@@ -138,7 +138,7 @@ class ProductPublicCategory(models.Model):
_order = "sequence, name"
name = fields.Char(required=True, translate=True)
parent_id = fields.Many2one('product.public.category', string='Parent Category', index=True)
parent_id = fields.Many2one('product.public.category', string='Parent Category', index=True, ondelete="cascade")
parent_path = fields.Char(index=True)
child_id = fields.One2many('product.public.category', 'parent_id', string='Children Categories')
parents_and_self = fields.Many2many('product.public.category', compute='_compute_parents_and_self')