[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/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! |
LoisRForgeFlow
left a comment
There was a problem hiding this comment.
The migration looks good, however there are a few additional commits. In this one this new tests dragged my attention, see my comment below:
| uninstall_hook(self.env, rule_ref) | ||
|
|
||
| self.assertFalse(rule.active) | ||
| self.assertIn("company_ids", rule.domain_force) |
There was a problem hiding this comment.
After applying uninstall hook company_ids remains in the domain? does it make sense?
There was a problem hiding this comment.
After applying uninstall hook company_ids remains in the domain? does it make sense?
Good catch, but this is intentional. The uninstall_hook is deprecated and its purpose is to deactivate the rule (active = False), not to restore the original domain. Since the rule is inactive, the domain_force content is irrelevant for security enforcement.
Keeping company_ids in the domain_force is a safety measure: if the module is reinstalled later, the post_init_hook will re-activate the rule with the correct domain. If we cleared the domain_force on uninstall, the rule would be re-activated with an empty/incorrect domain upon reinstall.
There was a problem hiding this comment.
@EmilioPascual Thanks for the explanation. This would probably need some more discussion, I think is not the cleanest way to resolve it. However, I also think it is not the most valuable discussion as uninstallation of this module will be really infrequent, not to mention re-installation. So let's move forward as is to focus on more important details :)
|
/ocabot migration base_multi_company |
Thanks for the report. This is a known limitation of the module's design: Modules that expect |
|
/ocabot merge nobump |
|
Hey, thanks for contributing! Proceeding to merge this for you. |
|
Congratulations, your PR was merged at c110ce7. Thanks a lot for contributing to OCA. ❤️ |
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