Skip to content

[18.0][FIX] edi_core_oca: fix search logic#216

Merged
OCA-git-bot merged 1 commit intoOCA:18.0from
ForgeFlow:18.0-fix-edi_core_oca
Mar 6, 2026
Merged

[18.0][FIX] edi_core_oca: fix search logic#216
OCA-git-bot merged 1 commit intoOCA:18.0from
ForgeFlow:18.0-fix-edi_core_oca

Conversation

@ThiagoMForgeFlow
Copy link
Copy Markdown
Contributor

Maintaining this part of code can occur a visual issue. If the result variable has 80 records (default by Odoo) and the orig_ids is less than result, Odoo only shows the orig_ids, and we lost the previous work finding next records.

In a multicompany environment, if you only enable one company you won't see all the records that you should. Real example:

  1. With only one company active you don't see all the records of that company.
screen1
  1. You can only access all the records activiating all the companies.
screen2

Do the same logic proposed in 15: OCA/edi#1147

@ForgeFlow

@OCA-git-bot
Copy link
Copy Markdown
Contributor

Hi @etobella, @simahawk,
some modules you are maintaining are being modified, check this out!

Copy link
Copy Markdown
Contributor

@simahawk simahawk left a comment

Choose a reason for hiding this comment

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

Can we have a test ?
To ensure that:

  1. final ordering is respected
  2. company visibility fix works

Gracias! :)

@etobella
Copy link
Copy Markdown
Member

@ThiagoMForgeFlow gentle reminder

@ThiagoMForgeFlow
Copy link
Copy Markdown
Contributor Author

Hi @simahawk and @etobella,

First of all, my apologies for the delayed response — I have been busy. I have just added a test that checks exactly what I mention in the PR. In this test, 100 edi.exchange.record records are created:

  • The first 60 are linked to a res.partner record belonging to one company.
  • The next 20 are linked to a res.partner record belonging to a new company.
  • The last 20 are linked to a res.partner record belonging to the same company as the first one.

Then, when performing a search with a limit of 80 (simulating Odoo view pagination), with only the first company active and using a non-superuser, the expected result is the first 60 records and the last 20. Keeping the line of code proposed to be removed in this PR, the actual result is only the first 60 records, because the additional 20 records (from the second pagination) are not part of orig_ids and therefore are not included in the final result:
result = [x for x in orig_ids if x in result]

@simahawk
Copy link
Copy Markdown
Contributor

simahawk commented Feb 3, 2026

@ThiagoMForgeFlow LGTM. Just one "efficiency" point: do we really need to create 100 records? Assuming we can control the limit I would say we can create way less records and save some computation time in the build. WDYT?

Maintaining this part of code can occur a visual issue. If the result variable has 80 records (default by Odoo) and the orig_ids is less than result, Odoo only shows the orig_ids, and we lost the previous work finding next records.
@ThiagoMForgeFlow
Copy link
Copy Markdown
Contributor Author

@ThiagoMForgeFlow LGTM. Just one "efficiency" point: do we really need to create 100 records? Assuming we can control the limit I would say we can create way less records and save some computation time in the build. WDYT?

I’ve just applied the change so that only 3 exchange records are created and the limit is set to 2.

@ThiagoMForgeFlow
Copy link
Copy Markdown
Contributor Author

Hi @simahawk could you do your final revision? Thanks :)

@simahawk
Copy link
Copy Markdown
Contributor

simahawk commented Mar 6, 2026

/ocabot merge patch

@OCA-git-bot
Copy link
Copy Markdown
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 18.0-ocabot-merge-pr-216-by-simahawk-bump-patch, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit ac754a6 into OCA:18.0 Mar 6, 2026
6 of 7 checks passed
@OCA-git-bot
Copy link
Copy Markdown
Contributor

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

@LoisRForgeFlow LoisRForgeFlow deleted the 18.0-fix-edi_core_oca branch March 9, 2026 09:09
@LoisRForgeFlow
Copy link
Copy Markdown
Contributor

@ThiagoMForgeFlow can you fwport this to 19?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants