[19.0][MIG] base_multi_company#1009
Conversation
9048459 to
d6b759f
Compare
d6b759f to
5bb33cf
Compare
|
@OCA/intercompany-maintainers could you review and merge it, please? Thank you |
|
This PR has the |
|
@EmilioPascual Please squash the commits as explained here: https://github.com/OCA/maintainer-tools/wiki/Merge-commits-in-pull-requests#mergesquash-the-commits-generated-by-bots-or-weblate |
5bb33cf to
2ce2349
Compare
Done. Thanks for the review. |
2ce2349 to
7f22851
Compare
* Create new module to provide base multi company logic and mixin * Add deactivation by company mixin * Add company_id/ids handling * Add break after company is found Squashed commits: [854cc36] Increase test coverage [770bd71] Revert hook view create back to model init [40e803e] Fix apples and oranges [7a4dfb4] Use registry correctly [6e9f170] Switch company_id to computed & move company aliased view creation to post init hook [faa4fc9] Remove active functionality [fecfb59] Add explicit tests for active and inactive searches
* Revert "Revert hook view create back to model init" This reverts commit 770bd71. * [FIX] base_multi_company: Always create the view into a pre_init_hook to avoid error in log
Squashed commits: [4c17d04] auto_join company_ids
…ch domain on company_id/company_ids (+1 squashed commit) Squashed commits: [fe161fe] [ADD] setup.py
- Test if a company is set in inverse method (+1 squashed commit) Squashed commits: [d670f30] [FIX] fix init hooks as company_id is not stored anymore
* Add implementation instructions to ReadMe
[FIX] Fix issue based on the computation of company_id for multi_company_abstract models [FIX] Fix issue based on the computation of company_id for multi_company_abstract models [FIX] Fix issue based on the computation of company_id for multi_company_abstract models [FIX] Bad branch version pushed before [FIX] Bad branch version pushed before [FIX] manifest Fix flake Flake8 on OCA tests
… are bound to some company
Currently translated at 88.9% (8 of 9 strings) Translation: multi-company-10.0/multi-company-10.0-base_multi_company Translate-URL: https://translation.odoo-community.org/projects/multi-company-10-0/multi-company-10-0-base_multi_company/pt/
Currently translated at 100.0% (4 of 4 strings) Translation: multi-company-18.0/multi-company-18.0-base_multi_company Translate-URL: https://translation.odoo-community.org/projects/multi-company-18-0/multi-company-18-0-base_multi_company/tr/
Prevent AccessError when users with limited company access edit records that have company_ids field.
The issue occurs because:
1. company_ids field values are cached without considering the current user.
2. When a sudo read happens first (e.g., during search), it caches ALL companies.
3. Later non-sudo reads use the same cached value, but the user only has access to some companies.
4. This causes AccessError when checking company permissions.
Solution:
- Add `depends_context=('uid',)` to company_ids field definition.
- This creates separate cache entries for different users (sudo vs non-sudo).
- Each user sees only the companies they have access to.
If fixes the problem reported in the issue OCA#929, using a similar approach as Odoo to solve a similar problem (this is Odoo's original fix PR --> odoo/odoo#217752).
Currently translated at 100.0% (4 of 4 strings) Translation: multi-company-18.0/multi-company-18.0-base_multi_company Translate-URL: https://translation.odoo-community.org/projects/multi-company-18-0/multi-company-18-0-base_multi_company/sl/
MT-14423 Co-authored-by: Vandan-SCS <73175574+Vandan-Pandeji-SerpentCS@users.noreply.github.com>
When a record is created or modified via onchange, `record.company_ids[:1]`
may be a virtual (unsaved) record whose `.id` is a `NewId`. Assigning that
to the computed `company_id` field propagates the `NewId` into any
downstream domain — most notably `_compute_same_vat_partner_id` in
`res.partner`, which builds a search domain with
`('company_id', 'in', [False, partner.company_id.id])` and triggers:
psycopg2.ProgrammingError: can't adapt type 'NewId'
MT-14423 MT-15070 @moduon
7f22851 to
0ad0d7e
Compare
|
Please @OCA/intercompany-maintainers could you review and merge it, please? Thank you! ❤️ @EmilioPascual add your self as maintainter, we are maintaining this module 5 years /ocabot migration base_multi_company |
|
Sorry @rafaelbn you are not allowed to mark the addon to be migrated. To do so you must either have push permissions on the repository, or be a declared maintainer of all modified addons. If you wish to adopt an addon and become it's maintainer, open a pull request to add your GitHub login to the |
|
Hello ✋🏼 🤗 Please @gurneyalex @legalsylvain @LoisRForgeFlow , could you merge this one? Is validated, aproved... etc. Running in prod 😄 ❤️ Others likes #1014 depends on this one Thank you! |
|
Hello. |
|
Thanks for the heads up @tristancatteeuw @EmilioPascual is on holidays right now, so he won't be able to review the issue until he's back |
|
Hello @tristancatteeuw : Did you tested in OCA's runboat? Technical name: data_cleaning data_cleaning module is Enterprise so don't affects in this PR Thank you! |
Supersed of #889
I have re-run the migration from the current version 18. The old pull request was quite old and was causing numerous inconsistencies with the latest changes.
I have tried to preserve the commit authorship as far as possible.
@Vandan-Pandeji-SerpentCS, @astirpe, @weinni2000, @Murtaza-OSI, @chienandalu, @yajo please review
@moduon MT-14423