multi-company icon indicating copy to clipboard operation
multi-company copied to clipboard

[17.0] [MIG] partner_multi_company: Migration to 17.0

Open rven opened this issue 1 year ago • 10 comments

rven avatar May 21 '24 13:05 rven

/ocabot migration partner_multi_company

pedrobaeza avatar May 21 '24 13:05 pedrobaeza

@rven Could you cherry-pick this recent change from v16 https://github.com/OCA/multi-company/pull/670 ?

Thanks

LoisRForgeFlow avatar Jul 23 '24 08:07 LoisRForgeFlow

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

Thanks

It's not approved yet!

rven avatar Jul 23 '24 13:07 rven

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

It's not approved yet!

It is now! :smile:

LoisRForgeFlow avatar Jul 24 '24 14:07 LoisRForgeFlow

@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 avatar Jul 25 '24 11:07 rven

@rven Thanks!

LoisRForgeFlow avatar Jul 25 '24 14:07 LoisRForgeFlow

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

LoisRForgeFlow avatar Jul 25 '24 14:07 LoisRForgeFlow

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

Done!

rven avatar Jul 26 '24 07:07 rven

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

rven avatar Jul 30 '24 13:07 rven

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.

rven avatar Sep 24 '24 05:09 rven

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 avatar Oct 14 '24 07:10 pilarvargas-tecnativa

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)

pilarvargas-tecnativa avatar Oct 14 '24 07:10 pilarvargas-tecnativa

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

It seems to be a runbot error, testing locally there is no error.

pilarvargas-tecnativa avatar Oct 25 '24 11:10 pilarvargas-tecnativa

@pedrobaeza Can you please check?

pilarvargas-tecnativa avatar Oct 25 '24 11:10 pilarvargas-tecnativa

Hey, thanks for contributing! Proceeding to merge this for you. Prepared branch 17.0-ocabot-merge-pr-626-by-pedrobaeza-bump-nobump, awaiting test results.

OCA-git-bot avatar Oct 25 '24 17:10 OCA-git-bot

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

OCA-git-bot avatar Oct 25 '24 17:10 OCA-git-bot