Skip to content

[FIX] [19.0] edi_core_oca: fix missing kw in super for _search(...) - #342

Merged
OCA-git-bot merged 1 commit into
OCA:19.0from
acsone:fix_edi_core_oca_search
Sep 10, 2026
Merged

[FIX] [19.0] edi_core_oca: fix missing kw in super for _search(...)#342
OCA-git-bot merged 1 commit into
OCA:19.0from
acsone:fix_edi_core_oca_search

Conversation

@acsonefho

Copy link
Copy Markdown
Contributor

Issue:
Missing **kw given to the super call.

How to reproduce:
Generate a edi.exchange.record with a parent and archive this parent.

When you try to open the form view of the child, you will have an Access Error because Odoo try to load the parent but as all args are not given to the super, the parent is not returned and Odoo perform this as a non-accessible record.

Fix:
Just give the **kw during call to super.

In this case the kw = {'active_test': False}

This change comes from Odoo who give this as a parameter in v19 (it was in the context in previous version):
19: https://github.com/odoo/odoo/blob/19.0/odoo/orm/models.py#L3802
18: https://github.com/odoo/odoo/blob/18.0/odoo/models.py#L4155

@OCA-git-bot

Copy link
Copy Markdown
Contributor

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

@acsonefho acsonefho changed the title [FIX] edi_core_oca: fix missing kw in super for _search(...) [FIX] [19.0] edi_core_oca: fix missing kw in super for _search(...) Sep 10, 2026
@simahawk

Copy link
Copy Markdown
Contributor

/ocabot merge patch

@simahawk

Copy link
Copy Markdown
Contributor

Thanks!

@OCA-git-bot

Copy link
Copy Markdown
Contributor

On my way to merge this fine PR!
Prepared branch 19.0-ocabot-merge-pr-342-by-simahawk-bump-patch, awaiting test results.

@acsonefho

acsonefho commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

@OCA-git-bot
OCA-git-bot merged commit 47239bd into OCA:19.0 Sep 10, 2026
7 checks passed
@OCA-git-bot

Copy link
Copy Markdown
Contributor

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

@acsonefho
acsonefho deleted the fix_edi_core_oca_search branch September 10, 2026 07:42
@simahawk

simahawk commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

@etobella @simahawk thank you for the quick review and merge 🚀

I don't know if these 2 lines should be fixed too: https://github.com/OCA/edi-framework/blob/19.0/edi_core_oca/models/edi_exchange_record.py#L634 https://github.com/OCA/edi-framework/blob/19.0/edi_core_oca/models/edi_exchange_record.py#L646

To have full ctx

case 2

            allowed = list(
                self.env[model]
                .with_context(active_test=False)
                ._search([("id", "in", recs.ids)])
            )

case 3

        if len(orig_ids) == limit and len(result) < len(orig_ids):
            extend_query = self._search(
                domain,
                offset=offset + len(orig_ids),
                limit=limit,
                order=order,
            )

For case 2 if passing active_test through context is still working we can keep it that way but might be worth to keep it consistent.
For case 3 we only miss bypass_access that in this context we don't care I think.

@etobella you might have a better picture on this part. I'll let you judge.

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.

4 participants