odoo/odoo#192342

Created by fw-bot
Merged at 66841677ffe4fa5a480f47d12fd57d252a831060

Statuses:

label
odoo-dev:18.0-17.0-h-79599-feg-7drR-fw
head
1b8a56e33f089b104c5d3912ce9d75858ff54542
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