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

[15.0] edi_oca: support multicompany with edi.exchange.record #933

Open
ThiagoMForgeFlow opened this issue Feb 13, 2024 · 2 comments
Open
Labels

Comments

@ThiagoMForgeFlow
Copy link

Module

edi_oca

Describe de bug

When you try to access the exchange records menus, a multi-company permissions error appears. If there are elements in the tree view whose model field contains record rules associated with multi-companies and the res_id field does not belong to the active companies, the error is displayed.

To Reproduce

Affected versions: I see the error in 15.0

Steps to reproduce the behavior:

  1. Have a multi-company record Rule for a model.
  2. Generate edi.exchange.record for the record rule model, with different companies.
  3. Access the exchange menu without having all the active companies

Expected behavior
When accessing the menu, only the elements that belong to the active companies should be displayed.

Additional context
To avoid this problem I have tried two solutions, but neither of them seem correct to me:

  1. Filter so that only the acces_rule is checked with the records of the active companies records = self.env[model].browse(rec_ids).with_user(self._uid).filtered(lambda x: x.sudo( ).company_id in self.env.companies.ids). This prevents the error from appearing but does not filter the elements that must be seen.
  2. Create a company_id field from the res_id and model fields, [15.0][IMP] edi_oca: add company_id to edi_exchange_record #932 but I have had problems in a real environment since there may be the case in which the loading order of the modules means that a model does not yet exist when trying to access him.
@LoisRForgeFlow
Copy link
Contributor

@simahawk @etobella your ideas would be much appreciated here

@etobella
Copy link
Member

Well, actually, the problem I see is another. We might need to filter edi records according to the rules of the related record.

Imagine you don't have access to employees and we create an edi exchange for employees, the same problem will arise.

WDYT?

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

No branches or pull requests

3 participants