[17.0] [MIG] partner_multi_company: Migration to 17.0
/ocabot migration partner_multi_company
@rven Could you cherry-pick this recent change from v16 https://github.com/OCA/multi-company/pull/670 ?
Thanks
@rven Could you cherry-pick this recent change from v16 #670 ?
Thanks
It's not approved yet!
@rven Could you cherry-pick this recent change from v16 #670 ? Thanks
It's not approved yet!
It is now! :smile:
@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 Thanks!
@rven Dependency merged! You can rebase and remove the test-requirements commit :rocket:
@rven Dependency merged! You can rebase and remove the test-requirements commit 🚀
Done!
Functional review, quite good. I found an error though:
- Have 3 companies.
- Create a user with access to company 1.
- Go to the related partner and assign company 1.
- Go back to the user and add company 2. Error raises:
Fixed the issue + did some code cleanup when adding extra test scenario's
Thanks for the fixes and sorry for the late review.
Another unexpected error I found:
- Create a user with access to company A and B (parter automatically has company A and B too 👍 )
- Save, and now edit the user again and remove company B while you are in company A:
- Error raises
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.
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.
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.
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)
Hello, Doing the following test I am getting this error:
It seems to be a runbot error, testing locally there is no error.
@pedrobaeza Can you please check?
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.
Congratulations, your PR was merged at 1412e6905d921c9ea1b5fc93209880b2566da15e. Thanks a lot for contributing to OCA. ❤️


