From aff4b58c1ffbdde97ba2db17aa1692d99b635ae2 Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Thu, 28 Nov 2019 18:05:50 +0000 Subject: [PATCH] [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) --- addons/website_sale/models/product.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/website_sale/models/product.py b/addons/website_sale/models/product.py index 876f4cba8cf..2193cfa6fcd 100644 --- a/addons/website_sale/models/product.py +++ b/addons/website_sale/models/product.py @@ -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')