OCA / openupgradelib

A library with support functions to be called from Odoo migration scripts.
GNU Affero General Public License v3.0
85 stars 171 forks source link

[11.0] `rating_rating` does not have `parent_res_model` column #347

Closed zamberjo closed 1 year ago

zamberjo commented 1 year ago

Describe the bug

The PR https://github.com/OCA/openupgradelib/pull/345 uses a column called parent_res_model which is added in odoo version 11.0.

Since this is executed in the pre-migrations, this column does not exist and gives an error:

2023-09-13 22:42:01,349 1167 ERROR migration_db odoo.sql_db: bad query: UPDATE rating_rating SET parent_res_model='ir.actions.report' where parent_res_model='ir.actions.report.xml'
ERROR: column "parent_res_model" does not exist
LINE 1: ...ng SET parent_res_model='ir.actions.report' where parent_res...

To Reproduce

Migrate an odoo10 to odoo11


Could we apply the following change?

if table_exists(cr, "rating_rating"):

to

if column_exists(cr, "rating_rating", "parent_res_model"):
zamberjo commented 1 year ago

ping @pedrobaeza @duong77476 @legalsylvain

pedrobaeza commented 1 year ago

It should be both conditions. Can you please make a PR?

zamberjo commented 1 year ago

done