odoo/odoo#182235

Created by fw-bot
Merged at 42e949c2763f57df7ac1456c8bf1fa0d57fb9e85

Statuses:

label
odoo-dev:saas-17.4-17.0-sale_project-avoid-stop-iteration-error-loug-8UEg-fw
head
7103d3e04ac94e77f8f4995d5b4ada85d5340e21
merged
9 months ago by Fun Services, Xavier Bol (xbo)
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: #181946