Skip to content

Conversation

@MiquelRForgeFlow
Copy link
Contributor

Avoids issue with accessing private methods (due to odoo/odoo@a1adf83).

I am not sure if I did correctly the monkey patch, it's not tested.

@OCA-git-bot
Copy link
Contributor

Hi @legalsylvain, @StefanRijnhart,
some modules you are maintaining are being modified, check this out!

Copy link
Member

@StefanRijnhart StefanRijnhart left a comment

Choose a reason for hiding this comment

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

For my (limited) understanding, do you have a concrete example where a migration triggers the exception?

@MiquelRForgeFlow
Copy link
Contributor Author

MiquelRForgeFlow commented Mar 4, 2025

This month, when I did a new analysis for v17, it broke when trying to access the mapped method, which is decorated with @api.private. This method is called in https://github.com/OCA/server-tools/blob/16.0/upgrade_analysis/models/upgrade_analysis.py#L554.

@StefanRijnhart
Copy link
Member

Thanks for clarifying. Can't believe they private'd mapped! It is literally mentioned as a cool trick in OdooRPC's documentation. Can you add this example to the documentation string of the monkey patch?

Copy link
Member

@StefanRijnhart StefanRijnhart left a comment

Choose a reason for hiding this comment

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

This is not how the odoo patch mechanism of this module works. The mechanism works with a derived class: https://github.com/OCA/server-tools/blob/16.0/upgrade_analysis/odoo_patch/odoo/modules/registry.py.

But a patch using the mechanism would not work, because it is only active on the calling side, and the mechanism is not applied when doing remote communication.

Maybe we should ask Odoo to reconsider privating mapped? Is it just this one method or are other calls affected as well?

@StefanRijnhart
Copy link
Member

FYI @sebalix OdooRPC is impacted by this new way of 'privatization' in Odoo.

legalsylvain added a commit to grap/server-tools that referenced this pull request Mar 4, 2025
FIX: OCA#3215.
Rational : 'mapped' function has been privatized in odoo/odoo@a1adf83.
We so replace 'mapped' by 'search_read'
@legalsylvain
Copy link
Contributor

Hi @MiquelRForgeFlow. thanks for your investigation.

At a first sight, I'm not in favor to add core patch, if it's not necessary. Here, If I'm right, #3218 can solve the problem you mention.
What do you think ?

thanks !

@MiquelRForgeFlow
Copy link
Contributor Author

Ok, let's replace this by #3218.

MiquelRForgeFlow pushed a commit to ForgeFlow/server-tools that referenced this pull request Mar 28, 2025
FIX: OCA#3215.
Rational : 'mapped' function has been privatized in odoo/odoo@a1adf83.
We so replace 'mapped' by 'search_read'
MiquelRForgeFlow pushed a commit to ForgeFlow/server-tools that referenced this pull request Mar 28, 2025
FIX: OCA#3215.
Rational : 'mapped' function has been privatized in odoo/odoo@a1adf83.
We so replace 'mapped' by 'search_read'
omalbastin pushed a commit to omalbastin/server-tools that referenced this pull request May 7, 2025
FIX: OCA#3215.
Rational : 'mapped' function has been privatized in odoo/odoo@a1adf83.
We so replace 'mapped' by 'search_read'
hbrunn pushed a commit to hbrunn/server-tools that referenced this pull request Sep 26, 2025
FIX: OCA#3215.
Rational : 'mapped' function has been privatized in odoo/odoo@a1adf83.
We so replace 'mapped' by 'search_read'
hbrunn pushed a commit to hbrunn/server-tools that referenced this pull request Sep 26, 2025
FIX: OCA#3215.
Rational : 'mapped' function has been privatized in odoo/odoo@a1adf83.
We so replace 'mapped' by 'search_read'
hbrunn pushed a commit to hbrunn/server-tools that referenced this pull request Dec 12, 2025
FIX: OCA#3215.
Rational : 'mapped' function has been privatized in odoo/odoo@a1adf83.
We so replace 'mapped' by 'search_read'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants