Skip to content

Conversation

@tfr-odoo
Copy link
Contributor

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

@tfr-odoo tfr-odoo requested a review from a team as a code owner June 11, 2021 17:09
@tfr-odoo tfr-odoo requested a review from tde-banana-odoo June 11, 2021 17:09
@robodoo
Copy link
Contributor

robodoo commented Jun 11, 2021

Pull request status dashboard

@C3POdoo C3POdoo added the RD research & development, internal work label Jun 11, 2021
@tfr-odoo tfr-odoo force-pushed the saas-14.3-fix-company-from-team-tfr branch from 7256b05 to e5a4119 Compare June 17, 2021 09:00
@tde-banana-odoo tde-banana-odoo marked this pull request as draft September 1, 2021 07:37
@robodoo
Copy link
Contributor

robodoo commented Sep 1, 2021

This PR targets the disabled branch odoo/odoo:saas-14.3, it can not be merged.

@tde-banana-odoo tde-banana-odoo force-pushed the saas-14.3-fix-company-from-team-tfr branch from e5a4119 to 36a51ad Compare September 1, 2021 07:44
@tde-banana-odoo tde-banana-odoo changed the base branch from saas-14.3 to saas-14.4 September 1, 2021 07:45
@tde-banana-odoo tde-banana-odoo marked this pull request as ready for review September 1, 2021 07:45
@tde-banana-odoo tde-banana-odoo force-pushed the saas-14.3-fix-company-from-team-tfr branch from 36a51ad to cd65d8a Compare September 1, 2021 08:42
@tde-banana-odoo tde-banana-odoo force-pushed the saas-14.3-fix-company-from-team-tfr branch 4 times, most recently from dc81d45 to 037836f Compare October 13, 2021 12:12
tde-banana-odoo and others added 2 commits October 22, 2021 16:38
Purpose of this commit is to highlight current behavior of multi company
in lead. Notably a company is set at creation even when no team or user
is set, leading to a lot of issues when dealing with lead merge or convert.

Task-2520276

Co-Authored-By: Thibault Delavallée <[email protected]>
Co-Authored-By: Thibault François <[email protected]>
Context
-------

Leads get assigned a different company than the one defined on the salesman
after being merged with another lead.

This happens because some leads assigned to a user_id have no company set. They
are merged with leads that receive self.env.company during assigment to the
to the team and then 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

Other changes
-------------

When resetting team and user: void company to avoid having leads without
any information but a company set. It eases assignment.

Task-2520276

Co-Authored-By: Thibault Delavallée <[email protected]>
Co-Authored-By: Thibault François <[email protected]>
@tde-banana-odoo tde-banana-odoo force-pushed the saas-14.3-fix-company-from-team-tfr branch from 037836f to 37c693e Compare October 22, 2021 14:39
@tde-banana-odoo
Copy link
Contributor

@robodoo r+ rebase-ff

@robodoo
Copy link
Contributor

robodoo commented Oct 22, 2021

Merge method set to rebase and fast-forward

robodoo pushed a commit that referenced this pull request Oct 22, 2021
Purpose of this commit is to highlight current behavior of multi company
in lead. Notably a company is set at creation even when no team or user
is set, leading to a lot of issues when dealing with lead merge or convert.

Task-2520276

Part-of: #72088
Co-authored-by: Thibault Delavallée <[email protected]>
Co-authored-by: Thibault François <[email protected]>
robodoo pushed a commit that referenced this pull request Oct 22, 2021
Context
-------

Leads get assigned a different company than the one defined on the salesman
after being merged with another lead.

This happens because some leads assigned to a user_id have no company set. They
are merged with leads that receive self.env.company during assigment to the
to the team and then 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

Other changes
-------------

When resetting team and user: void company to avoid having leads without
any information but a company set. It eases assignment.

Task-2520276

closes #72088

Signed-off-by: Thibault Delavallee (tde) <[email protected]>
Co-authored-by: Thibault Delavallée <[email protected]>
Co-authored-by: Thibault François <[email protected]>
@robodoo robodoo closed this Oct 22, 2021
@robodoo robodoo temporarily deployed to merge October 22, 2021 16:35 Inactive
@fw-bot
Copy link
Contributor

fw-bot commented Oct 26, 2021

This pull request has forward-port PRs awaiting action (not merged or closed): #78860

1 similar comment
@fw-bot
Copy link
Contributor

fw-bot commented Oct 27, 2021

This pull request has forward-port PRs awaiting action (not merged or closed): #78860

@fw-bot fw-bot deleted the saas-14.3-fix-company-from-team-tfr branch November 5, 2021 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

RD research & development, internal work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants