Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0][FIX] partner_multi_company: default value for res_partner.company_ids #575

Merged

Conversation

PicchiSeba
Copy link
Contributor

@PicchiSeba PicchiSeba commented Jan 24, 2024

When company_ids is not set that means the contact will be available to all companies. This might create some noise and unwanted behavior.

A user assigned to only one company that creates a new contact without changing the company_ids field is going to make the contact available for anyone.

We can set the field to the current company in order to prevent this. If the user really wants to make the contact available to everyone they have to manually change the field.

Moreover the current module behavior goes against what's written in the USAGE file

On the partner form view, go to the "Sales & Purchases" tab, and put the companies in which you want to use that partner. If none is selected, the partner will be visible in all of them. The default value is the current one.

Copy link
Contributor

@francesco-ooops francesco-ooops left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functional ok

@pedrobaeza asking for your opinion on this:

  • for sure it's not correct that users with only one allowed company can create partners for all companies, so that should be fixed somehow
  • I also don't want to change existing behaviors without notice

How do you suggest we approach this? Should we implement this behavior optionally through a setting?

@PicchiSeba PicchiSeba force-pushed the 14.0-base_multi_company-default-company_ids branch 2 times, most recently from b242947 to aff412e Compare January 25, 2024 16:02
@PicchiSeba PicchiSeba marked this pull request as draft January 26, 2024 07:43
@PicchiSeba PicchiSeba force-pushed the 14.0-base_multi_company-default-company_ids branch from aff412e to 6557670 Compare January 26, 2024 09:16
@PicchiSeba PicchiSeba marked this pull request as ready for review January 26, 2024 09:30
@PicchiSeba PicchiSeba force-pushed the 14.0-base_multi_company-default-company_ids branch 3 times, most recently from cf87043 to 40b4c6f Compare January 29, 2024 13:13
@PicchiSeba
Copy link
Contributor Author

Updated the docs with the new option

@PicchiSeba PicchiSeba force-pushed the 14.0-base_multi_company-default-company_ids branch from 40b4c6f to cc5c420 Compare January 29, 2024 13:53
@PicchiSeba
Copy link
Contributor Author

I also added a test to address these changes

@PicchiSeba PicchiSeba force-pushed the 14.0-base_multi_company-default-company_ids branch 2 times, most recently from 339bb23 to 014fc22 Compare January 29, 2024 14:29
@PicchiSeba
Copy link
Contributor Author

Ok, we should be good by now.

Let me know if you see any issue

@PicchiSeba PicchiSeba force-pushed the 14.0-base_multi_company-default-company_ids branch 2 times, most recently from db0bac4 to cf8cc37 Compare January 29, 2024 14:51
Copy link
Contributor

@renda-dev renda-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code and functional review, LGTM

partner_multi_company/models/res_partner.py Outdated Show resolved Hide resolved
@PicchiSeba PicchiSeba force-pushed the 14.0-base_multi_company-default-company_ids branch from cf8cc37 to 1bf88ee Compare January 29, 2024 16:27
@francesco-ooops
Copy link
Contributor

@pedrobaeza in the end we went for the setting, in order to minimize disruption. Let us know if it's good for merge, thanks!

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

Copy link
Contributor

@aleuffre aleuffre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review, LGTM

In the tests, there are probably simpler ways to to fix the issue with the missing accounts, but that's still fine IMO.

@francesco-ooops
Copy link
Contributor

@pedrobaeza shall we merge?

@pedrobaeza pedrobaeza added this to the 14.0 milestone Feb 1, 2024
@pedrobaeza
Copy link
Member

/ocabot merge minor

@OCA-git-bot
Copy link
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 14.0-ocabot-merge-pr-575-by-pedrobaeza-bump-minor, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 15171ea into OCA:14.0 Feb 1, 2024
11 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 732e0cf. Thanks a lot for contributing to OCA. ❤️

@PicchiSeba PicchiSeba deleted the 14.0-base_multi_company-default-company_ids branch February 1, 2024 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants