OCA / multi-company

GNU Affero General Public License v3.0
97 stars 279 forks source link

[16.0] account_multicompany_easy_creation : incompatibility with pos_restaurant #632

Closed legalsylvain closed 1 month ago

legalsylvain commented 1 month ago

Module

account_multicompany_easy_creation

Describe the bug

the module account_multicompany_easy_creation can not be in a repo with another module that depends on pos_restaurant

To Reproduce

Affected versions: 16.0 (at least)

Steps to reproduce the behavior:

  1. create a new db and install account_multicompany_easy_creation and pos_restaurant
  2. run test
2024-06-04 21:35:04,301 28976 ERROR account_multicompany_easy_creation_22 odoo.addons.account_multicompany_easy_creation.tests.test_easy_creation: ERROR: Subtest TestEasyCreation.test_wizard_easy_creation_test_user (login='test-user')
Traceback (most recent call last):
  File "<decorator-gen-204>", line 2, in test_wizard_easy_creation_test_user
  File "./src/odoo/odoo/tests/common.py", line 1871, in _users
    func(*args, **kwargs)
  File "./src/OCA/multi-company/account_multicompany_easy_creation/tests/test_easy_creation.py", line 76, in test_wizard_easy_creation_test_user
    self.test_wizard_easy_creation()
  File "./src/OCA/multi-company/account_multicompany_easy_creation/tests/test_easy_creation.py", line 64, in test_wizard_easy_creation
    record.action_accept()
  File "./src/OCA/multi-company/account_multicompany_easy_creation/wizards/multicompany_easy_creation.py", line 417, in action_accept
    self.create_company()
  File "./src/OCA/multi-company/account_multicompany_easy_creation/wizards/multicompany_easy_creation.py", line 194, in create_company
    self.with_context(
  File "./src/odoo/addons/account/models/chart_template.py", line 486, in try_loading
    template.with_context(default_company_id=company.id)._load(company)
  File "./src/odoo/addons/point_of_sale/models/chart_template.py", line 15, in _load
    self.env['pos.payment.method'].search([('company_id', '=', company.id)]).unlink()
  File "./src/odoo/odoo/models.py", line 1519, in search
    res = self._search(domain, offset=offset, limit=limit, order=order, count=count)
  File "./src/odoo/odoo/models.py", line 4673, in _search
    model.check_access_rights('read')
  File "./src/odoo/odoo/models.py", line 3471, in check_access_rights
    return self.env['ir.model.access'].check(self._name, operation, raise_exception)
  File "/src/odoo/odoo/addons/base/models/ir_model.py", line 1917, in check
    raise AccessError(msg)
odoo.exceptions.AccessError: You are not allowed to access 'Point of Sale Payment Methods' (pos.payment.method) records.

This operation is allowed for the following groups:
    - Point of Sale/Administrator
    - Point of Sale/User

Conséquency

Possible Alternative

CC : developpers :

thanks !

pedrobaeza commented 1 month ago

This is the "day to day" task we are having when migrating or adding modules, discovering somehow the incompatibilities between modules, but normally it's the duty of the one who is introducing the module who has to check it.

legalsylvain commented 1 month ago

but normally it's the duty of the one who is introducing the module who has to check it.

I checked and identified the problem. But I took a look and don't know how to fix it. I'm not sure to understand : Do you mean a contributor to a module has to fix problems of existing modules in the repo ?

pedrobaeza commented 1 month ago

I don't see in your report that the problem is really in the other module, and well, what I'm saying is that someone has to do the dirty work, and we have done it a lot of times for other modules that are not ours.

legalsylvain commented 1 month ago

I don't see in your report that the problem is really in the other module

Basically :

So maybe there is something wrong in Odoo / PoS account framework, but IMO OCA module should have test green whatever Odoo modules are installed.

and we have done it a lot of times for other modules that are not ours.

we know you're doing a great job at the OCA, and so am I. This is not the point.

Note : test are green if account_multicompany_easy_creation is tested isolated. (See : https://github.com/OCA/multi-company/pull/537 CI)

pedrobaeza commented 1 month ago

Solved in eb61fefa9e06a090f45e536f7dbe03fb9be9b1b4