odoo/upgrade-util#359

Created by Sanchit Gupta (sagu)

Blocked

label
odoo-dev:master-fix_get_column_name_by_type-sagu
head
759317a0b640c505dce0d46c67532a36ccd75d48
odoo/upgrade-util
master #359 missing r+

[FIX] util/pg: get only common name with same type

Description:-

  1. This commit Add param type_check get the common columns info with same typcategory or same data type and skipp the column with different datatype and different type

  2. all column name should be returned

Traceback (most recent call last):
  File "/home/odoo/src/odoo/19.0/odoo/service/server.py", line 1514, in preload_registries
    registry = Registry.new(dbname, update_module=update_module, install_modules=config['init'], upgrade_modules=config['update'], reinit_modules=config['reinit'])
  File "/home/odoo/src/odoo/19.0/odoo/tools/func.py", line 88, in locked
    return func(inst, *args, **kwargs)
  File "/home/odoo/src/odoo/19.0/odoo/orm/registry.py", line 186, in new
    load_modules(
  File "/home/odoo/src/odoo/19.0/odoo/modules/loading.py", line 493, in load_modules
    migrations.migrate_module(package, 'end')
  File "/home/odoo/src/odoo/19.0/odoo/modules/migration.py", line 220, in migrate_module
    exec_script(self.cr, installed_version, pyfile, pkg.name, stage, stageformat[stage] % version)
  File "/home/odoo/src/odoo/19.0/odoo/modules/migration.py", line 257, in exec_script
    mod.migrate(cr, installed_version)
  File "/tmp/tmp7yriz79e/migrations/hr/saas~18.4.1.1/end-migrate.py", line 87, in migrate
    cr.execute(query, [e[1] for e in required_default_values])
  File "/home/odoo/src/odoo/19.0/odoo/sql_db.py", line 426, in execute
    self._obj.execute(query, params)
psycopg2.errors.DatatypeMismatch: column "fondo_ahorro" is of type boolean but expression is of type double precision
LINE 16: ..."."distance_home_work_unit", "e"."employee_type", "e"."fondo...
                                                              ^
HINT:  You will need to rewrite or cast the expression.
select id,name,model,ttype,store from ir_model_fields where name='fondo_ahorro';
  id   |     name     |         model         |  ttype  | store
-------+--------------+-----------------------+---------+-------
 28361 | fondo_ahorro | hr.employee           | float   | t
 28687 | fondo_ahorro | calculo.liquidaciones | float   | t
 28379 | fondo_ahorro | hr.version            | boolean | t
(3 rows)

upg-3444635
opw-5260147
TBG-2328