odoo/odoo#72088
Created by Platform, Thibault Francois
Statuses:
- legal/cla: Contributor License Agreement check
- ci/runbot: Odoo Test Suite
- ci/upgrade_enterprise: Test upgrades for enterprise master
- ci/template: Contact runbot team for help in case of failure.
- ci/style: Optional style check. Ignore it only if strictly necessary.
- ci/security: Required security check. Can only be ignored by security team.
- label
- odoo-dev:saas-14.3-fix-company-from-team-tfr
- head
- 37c693e625054993bb95d8384ba9f0d3d04505db
- merged
- 4 years ago by Marketing, Thibault Delavallee (tde)
| odoo/odoo | |
|---|---|
| saas-14.4 | #72088 |
| 15.0 | #78854 |
| 16.0 | |
| 17.0 | |
| 18.0 | |
| saas-18.2 | |
| saas-18.3 | |
| saas-18.4 | |
| 19.0 | |
| master | #78860 |
[FIX] crm: Fix lead multicompany issue
Context
Lead get assigned a different company than the one defined on the
salesman after being merge with another lead.
This happen because some lead assigned to a user_id have no company set
are merge with lead that receive self.env.company during automated
assignation to the team and than get merged with the lead without
company. So the company of the new lead is written on the old one.
Behavior before this PR
When the crm.team have the field company_id = False
With the following flow
1) Create a lead without a user_id and a team_id
2) Assign a team to the lead
3) Assign a user_id
The status of the company field on the lead is the following
1) set the company of the env.user
2) Keep the company of the lead
3) set the user company if the current company is not one of the allowed company of the user
Behavior after this PR
1) set the company of the env.user
2) set the company of the team even if it's False
(so erase the company if the team has no company set)
3) set the user company if the current company is not one of the allowed company of the user
Description of the issue/feature this PR addresses:
Current behavior before PR:
Desired behavior after PR is merged:
--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr