Skip to content

[IMP] util,base: use cursor's mangled names #241

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tbe-odoo
Copy link

@tbe-odoo tbe-odoo commented Apr 1, 2025

  • The psycopg2 technical objects are now mangled inside the Odoo cursors. This is made to avoid using them improperly. So we must adapt the code to use new names.

Related to:

odoo/odoo#204273
https://github.com/odoo/enterprise/pull/82655
https://github.com/odoo/upgrade/pull/7478

@robodoo
Copy link
Contributor

robodoo commented Apr 1, 2025

Pull request status dashboard

@KangOl
Copy link
Contributor

KangOl commented Apr 1, 2025

upgradeci retry with always only hr

@tbe-odoo tbe-odoo force-pushed the master-wrap-cnx-tbe branch 2 times, most recently from 511a34a to e861904 Compare April 3, 2025 13:11
@@ -20,7 +20,7 @@ def migrate(cr, version):
"""
)
execute_values(
cr._obj,
getattr(cr, '_obj__', None) or cr._obj,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
getattr(cr, '_obj__', None) or cr._obj,
cr,

@@ -1484,7 +1485,7 @@ def update_server_actions_fields(cr, src_model, dst_model=None, fields_mapping=N
)
else:
psycopg2.extras.execute_values(
cr._obj,
getattr(cr, '_obj__') or cr._obj,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
getattr(cr, '_obj__') or cr._obj,
cr,

@@ -1476,7 +1476,7 @@ def replace_record_references_batch(cr, id_mapping, model_src, model_dst=None, r
ignores.append("ir_model_data")

cr.execute("CREATE UNLOGGED TABLE _upgrade_rrr(old int PRIMARY KEY, new int)")
execute_values(cr, "INSERT INTO _upgrade_rrr (old, new) VALUES %s", id_mapping.items())
execute_values(getattr(cr, '_obj__', cr), "INSERT INTO _upgrade_rrr (old, new) VALUES %s", id_mapping.items())
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
execute_values(getattr(cr, '_obj__', cr), "INSERT INTO _upgrade_rrr (old, new) VALUES %s", id_mapping.items())
execute_values(cr, "INSERT INTO _upgrade_rrr (old, new) VALUES %s", id_mapping.items())

  - The psycopg2 technical objects are now "dundered" inside the Odoo
    cursors.
    This is made to avoid using them improperly.
    So we must adapt the code to use new names.

Related to:

odoo/odoo#204273
odoo/enterprise#82655
odoo/upgrade#7478
@tbe-odoo tbe-odoo force-pushed the master-wrap-cnx-tbe branch from e861904 to 7d124cc Compare April 3, 2025 15:57
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.

3 participants