[IMP] analytic_plan: don't allow user to choose a parent's plan which

create a recursion

Problem
---------

When you have an analytics plans which is the parent of another one, you
should not be able to choose the child plan as parent of this one.

A user has the possibility to do it; when he saves, we he gets the
error: Recursion Detected.

Objective
---------

Don't show the child plans of an analytics plan to avoid the user to
choose something that raises the error.

Solution
---------

Update the domain of the field `parent_id` to exclude the analytic plans
that are the children of the current plan.

task-3414188

closes odoo/odoo#128302

Signed-off-by: Quentin De Paoli <qdp@odoo.com>
This commit is contained in:
Antoine Boonen
2023-08-03 19:30:59 +02:00
parent 73317cb9d1
commit 3e9f312ec2
+1 -1
View File
@@ -22,7 +22,7 @@ class AccountAnalyticPlan(models.Model):
string="Parent",
ondelete='cascade',
check_company=True,
domain="[('id', '!=', id)]",
domain="['!', ('id', 'child_of', id)]",
)
parent_path = fields.Char(
index='btree',