odoo/odoo#182406

Created by fw-bot
Merged at 2b3f8ca22c23fb57221d6293d8b003cd93d03a67

Statuses:

label
odoo-dev:master-17.0-sale_project-avoid-stop-iteration-error-loug-oGVT-fw
head
bdb4585c38bb637e5259f5d5ea482a37c8de868a
merged
9 months ago by Training, Louis Gobert (loug)
odoo/odoo
17.0 #181946
saas-17.2 #182220
saas-17.4 #182235
18.0 #182384
saas-18.1
saas-18.2
saas-18.3
master #182406

[FW][FIX] sale_project: avoid stop iteration issue

Steps to reproduce:
1. Install the sale_project module.
2. Create a product with the following properties:
- Type: 'Service'
- Create on Order: 'Project & Task'
4. Create a sale order and add the product to it.
5. Confirm the sale order.
6. In another tab, change the product type to 'Consumable' in the product form (a popup will appear informing you that you cannot change the type, but it can be dismissed.)

The issue arises because the 'Project' smart button remains visible in the sale order tab until the page is reloaded, and there are no longer any order lines with a product of type 'Service', resulting in a StopIteration error.

Closes #180340

Forward-Port-Of: #182235
Forward-Port-Of: #181946