odoo/odoo#192472

Created by fw-bot
Merged at 477d36351c8c669ac8d19353e096a3cd56547374

Statuses:

label
odoo-dev:saas-18.1-17.0-h-79599-feg-IhD9-fw
head
e01db64194d08ba758143514de8774cf928fd674
merged
9 months ago by Sales, Victor Feyens (vfe)
odoo/odoo
17.0 #181244
saas-17.2 #191674
saas-17.4 #192242
18.0 #192342
saas-18.1 #192472
saas-18.2
saas-18.3
saas-18.4
19.0
master #192614

[FW][FIX] sales: computing sales team in invoice

Versions
16.0+

Description of the issue/feature this PR addresses:

The issue occurs when selecting a partner in an invoice, the sales team is not correctly computed. The problem arises because the default_team_id is not passed as a parameter to the context when the partner is selected, which works correctly in sales orders but fails in invoices.

Current behavior before PR:

When modifying the partner_id in an invoice, the sales team is not recomputed, leading to incorrect or missing sales team assignment.

Desired behavior after PR is merged:

After this PR is merged, modifying the partner_id on an invoice will correctly recompute the sales team by passing the default_team_id in the context, ensuring consistent behavior between invoices and sales orders.

I will now provide a short video demonstrating the error. This issue is replicable if none of the sales teams have any members assigned.
https://drive.google.com/file/d/15mUpXvdlVpGZXW976PK7EVYH6X4sm2CJ/view?usp=sharing

PR of v16 #180961

Forward-Port-Of: #192242
Forward-Port-Of: #181244