summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorNicolas Lempereur <nle@odoo.com>2019-11-28 18:05:50 +0000
committerNicolas Lempereur <nle@odoo.com>2019-12-02 14:29:21 +0000
commitaff4b58c1ffbdde97ba2db17aa1692d99b635ae2 (patch)
tree0205df6ee748f001aae7e96364d9d73e8152d01d /addons
parent22b9343c9ac84099ab500b5617f14c1c3d1e4c05 (diff)
[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>
Diffstat (limited to 'addons')
-rw-r--r--addons/website_sale/models/product.py2
1 files changed, 1 insertions, 1 deletions
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')