odoo/odoo#159565
Created by fw-bot
- label
- odoo-dev:saas-17.2-17.0-OPW-3760372-crm_child_of_search_error-kdeb-rlce-fw
- head
- 04038e04cb699ffaa1f765202b219320f0b9d4aa
- target
- saas-17.2
- merged
- 2 months ago by Kawtar Drissi El Bouzaidi (kdeb)
- forward-port of
- odoo/odoo#159296
[FW][FIX] crm: resolve NewId error linking opportunity to contact via studio
## Issue:
- When adding opportunity/lead to a contact using Studio and attempt to add a line, we encounter the following error:"TypeError: 'NewId' object is not iterable."
## Steps To Reproduce:
- In a contact form open Studio and add a O2M field Customer (Lead/Opportunity)
- Try to add a line
- Notice Traceback Error "TypeError: 'NewId' object is not iterable"
## Solution:
- The issue arises in the search domain of `return_if_relevant` , exactly in ("partner_id", "child_of", lead.partner_id.commercial_partner_id.id) where the type of `lead.partner_id.commercial_partner_id.id` is NewId since the partner is being edited to add a task. This action triggers the `parse` and `to_ids` methods with a value type of NewId. thus the error.
- The operator child_of expects a list of IDs, and the ids property refer to the record's origin ids. to resolve this, replace `commercial_partner_id.id` with `commercial_partner_id.ids`.
opw-3760372
---
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
Forward-Port-Of: odoo/odoo#159296