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

[17.0] [MIG] partner_multi_company: Migration to 17.0 #626

Open
wants to merge 45 commits into
base: 17.0
Choose a base branch
from

Conversation

rven
Copy link

@rven rven commented May 21, 2024

No description provided.

@pedrobaeza
Copy link
Member

/ocabot migration partner_multi_company

@OCA-git-bot OCA-git-bot added this to the 17.0 milestone May 21, 2024
@OCA-git-bot OCA-git-bot mentioned this pull request May 21, 2024
14 tasks
@LoisRForgeFlow
Copy link
Contributor

@rven Could you cherry-pick this recent change from v16 #670 ?

Thanks

@rven
Copy link
Author

rven commented Jul 23, 2024

@rven Could you cherry-pick this recent change from v16 #670 ?

Thanks

It's not approved yet!

@LoisRForgeFlow
Copy link
Contributor

@rven Could you cherry-pick this recent change from v16 #670 ?
Thanks

It's not approved yet!

It is now! 😄

@rven rven force-pushed the 17.0-mig-partner_multi_company branch from e0fd403 to 2d9f0bd Compare July 25, 2024 11:57
@rven
Copy link
Author

rven commented Jul 25, 2024

@rven Could you cherry-pick this recent change from v16 #670 ?
Thanks

It's not approved yet!

It is now! 😄

Done! I had to rewrite the hooks.py a little bit and removed the migration script.

@rven rven force-pushed the 17.0-mig-partner_multi_company branch from 2d9f0bd to c17639f Compare July 25, 2024 12:15
@LoisRForgeFlow
Copy link
Contributor

@rven Thanks!

@LoisRForgeFlow
Copy link
Contributor

@rven Dependency merged! You can rebase and remove the test-requirements commit 🚀

oihane and others added 19 commits July 26, 2024 09:19
This fix prevents errors when there are other tests that create partners
and base_suspend_security is still not ready. There can be still problems
if these partners are not created with SUPERUSER.
* Bump versions
* Rename manifest
* Rename openerp to odoo
* Implement base_multi_company

Add depends

Swap dependencies

Add base_suspend_security depend back & server-tools repo

Fix tests

Add test for partner._commercial_fields

Why not both?!
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: multi-company-11.0/multi-company-11.0-partner_multi_company
Translate-URL: https://translation.odoo-community.org/projects/multi-company-11-0/multi-company-11-0-partner_multi_company/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: multi-company-12.0/multi-company-12.0-partner_multi_company
Translate-URL: https://translation.odoo-community.org/projects/multi-company-12-0/multi-company-12-0-partner_multi_company/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: multi-company-12.0/multi-company-12.0-partner_multi_company
Translate-URL: https://translation.odoo-community.org/projects/multi-company-12-0/multi-company-12-0-partner_multi_company/
OCA-git-bot and others added 19 commits July 26, 2024 09:19
Currently translated at 100.0% (3 of 3 strings)

Translation: multi-company-13.0/multi-company-13.0-partner_multi_company
Translate-URL: https://translation.odoo-community.org/projects/multi-company-13-0/multi-company-13-0-partner_multi_company/es/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: multi-company-16.0/multi-company-16.0-partner_multi_company
Translate-URL: https://translation.odoo-community.org/projects/multi-company-16-0/multi-company-16-0-partner_multi_company/
Currently translated at 100.0% (5 of 5 strings)

Translation: multi-company-16.0/multi-company-16.0-partner_multi_company
Translate-URL: https://translation.odoo-community.org/projects/multi-company-16-0/multi-company-16-0-partner_multi_company/es/
Preserving those partners that have a restriction on a specific
company before installing the module.

TT46870
Currently translated at 100.0% (5 of 5 strings)

Translation: multi-company-16.0/multi-company-16.0-partner_multi_company
Translate-URL: https://translation.odoo-community.org/projects/multi-company-16-0/multi-company-16-0-partner_multi_company/it/
@rven rven force-pushed the 17.0-mig-partner_multi_company branch from c17639f to 9302c3f Compare July 26, 2024 07:20
@rven
Copy link
Author

rven commented Jul 26, 2024

@rven Dependency merged! You can rebase and remove the test-requirements commit 🚀

Done!

Copy link
Contributor

@LoisRForgeFlow LoisRForgeFlow left a comment

Choose a reason for hiding this comment

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

Functional review, quite good. I found an error though:

  1. Have 3 companies.
  2. Create a user with access to company 1.
  3. Go to the related partner and assign company 1.
  4. Go back to the user and add company 2. Error raises:

image

@rven rven force-pushed the 17.0-mig-partner_multi_company branch from 9302c3f to 07b3368 Compare July 30, 2024 13:00
@rven rven force-pushed the 17.0-mig-partner_multi_company branch from 07b3368 to ccb28f2 Compare July 30, 2024 13:18
@rven
Copy link
Author

rven commented Jul 30, 2024

Functional review, quite good. I found an error though:

  1. Have 3 companies.
  2. Create a user with access to company 1.
  3. Go to the related partner and assign company 1.
  4. Go back to the user and add company 2. Error raises:

image

Fixed the issue + did some code cleanup when adding extra test scenario's

Copy link
Contributor

@LoisRForgeFlow LoisRForgeFlow left a comment

Choose a reason for hiding this comment

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

Thanks for the fixes and sorry for the late review.

Another unexpected error I found:

  1. Create a user with access to company A and B (parter automatically has company A and B too 👍 )
  2. Save, and now edit the user again and remove company B while you are in company A:
    image
  3. Error raises
    image

@rven
Copy link
Author

rven commented Sep 24, 2024

Thanks for the fixes and sorry for the late review.

Another unexpected error I found:

  1. Create a user with access to company A and B (parter automatically has company A and B too 👍 )
  2. Save, and now edit the user again and remove company B while you are in company A:
    image
  3. Error raises
    image

How can this be fixed? Because I think the problem here is that Company A is still defined as the Default Company of the user.
In this case you could say switch it automatically to Company B, but what in case if Company C, Company D is also defined in the allowed companies of the user.

@pilarvargas-tecnativa
Copy link

Thanks for the fixes and sorry for the late review.

Another unexpected error I found:

Effectively this error is because Company A is set as the default company and that is why the validation error occurs because the default company is not among the allowed companies.

@pilarvargas-tecnativa
Copy link

Hello,
Doing the following test I am getting this error:

Using Admin as user, I have created 2 companies (Company 1 and Company 2).
In total 3 companies are allowed.
I have changed the default company to company 2.
image
I have removed company 1 from the allowed companies and I get the following error:

Traceback (most recent call last):
  File "/opt/odoo/custom/src/odoo/odoo/http.py", line 1783, in _serve_db
    return service_model.retrying(self._serve_ir_http, self.env)
  File "/opt/odoo/custom/src/odoo/odoo/service/model.py", line 133, in retrying
    result = func()
  File "/opt/odoo/custom/src/odoo/odoo/http.py", line 1810, in _serve_ir_http
    response = self.dispatcher.dispatch(rule.endpoint, args)
  File "/opt/odoo/custom/src/odoo/odoo/http.py", line 2014, in dispatch
    result = self.request.registry['ir.http']._dispatch(endpoint)
  File "/opt/odoo/custom/src/odoo/odoo/addons/base/models/ir_http.py", line 222, in _dispatch
    result = endpoint(**request.params)
  File "/opt/odoo/custom/src/odoo/odoo/http.py", line 759, in route_wrapper
    result = endpoint(self, *args, **params_ok)
  File "/opt/odoo/auto/addons/web/controllers/dataset.py", line 24, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "/opt/odoo/auto/addons/web/controllers/dataset.py", line 20, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/opt/odoo/custom/src/odoo/odoo/api.py", line 468, in call_kw
    result = _call_kw_multi(method, model, args, kwargs)
  File "/opt/odoo/custom/src/odoo/odoo/api.py", line 453, in _call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/opt/odoo/auto/addons/web/models/models.py", line 71, in web_save
    self.write(vals)
  File "/opt/odoo/auto/addons/auth_totp_mail/models/res_users.py", line 11, in write
    res = super().write(vals)
  File "/opt/odoo/auto/addons/mail/models/discuss/res_users.py", line 17, in write
    res = super().write(vals)
  File "/opt/odoo/auto/addons/mail/models/res_users.py", line 105, in write
    write_res = super(Users, self).write(vals)
  File "/opt/odoo/auto/addons/resource/models/res_users.py", line 17, in write
    rslt = super().write(vals)
  File "/opt/odoo/auto/addons/partner_multi_company/models/res_users.py", line 31, in write
    new_company_ids = item[2]
IndexError: list index out of range

The above server error caused the following client error:
RPC_ERROR: Odoo Server Error
    RPC_ERROR
        at makeErrorFromResponse (http://localhost:17069/web/assets/7c29eb4/web.assets_web.min.js:2888:163)
        at XMLHttpRequest.<anonymous> (http://localhost:17069/web/assets/7c29eb4/web.assets_web.min.js:2892:13)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.