odoo/odoo#181244

Created by feg-adhoc
Merged at ef0bd48c7c62323cf27b6d722c9ca3271bbb8fa4

Statuses:

label
adhoc-dev:17.0-h-79599-feg
head
240b1e73b502b95cbde53e949c539ff376470495
merged
10 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

[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