Skip to content

Commit e6f36d0

Browse files
committed
[FIX] util/records: Fix typo rename xmlid
if here ``rename_xmlid`` is used in 16.0 base pre arch_db didn't converted in jsonb it will convert after module load so fixing it accordingly ``` Traceback (most recent call last): File "/home/odoo/src/odoo/16.0/odoo/service/server.py", line 1327, in preload_registries registry = Registry.new(dbname, update_module=update_module) File "<decorator-gen-16>", line 2, in new File "/home/odoo/src/odoo/16.0/odoo/tools/func.py", line 87, in locked return func(inst, *args, **kwargs) File "/home/odoo/src/odoo/16.0/odoo/modules/registry.py", line 87, in new odoo.modules.load_modules(registry, force_demo, status, update_module) File "/home/odoo/src/odoo/16.0/odoo/modules/loading.py", line 434, in load_modules loaded_modules, processed_modules = load_module_graph( File "/home/odoo/src/odoo/16.0/odoo/modules/loading.py", line 185, in load_module_graph migrations.migrate_module(package, 'pre') File "/home/odoo/src/odoo/16.0/odoo/modules/migration.py", line 170, in migrate_module exec_script(self.cr, installed_version, pyfile, pkg.name, stage, stageformat[stage] % version) File "/home/odoo/src/odoo/16.0/odoo/modules/migration.py", line 188, in exec_script migrate(cr, installed_version) File "/tmp/tmpabdby08e/migrations/base/16.0.1.3/pre--migrate.py", line 6, in migrate util.rename_xmlid(cr, *eb("{sale, __export__}.report_quotation_heading")) File "/tmp/tmpabdby08e/migrations/util/records.py", line 813, in rename_xmlid replace_in_all_jsonb_values( File "/tmp/tmpabdby08e/migrations/util/records.py", line 1843, in replace_in_all_jsonb_values cr.execute(query) File "/home/odoo/src/odoo/16.0/odoo/sql_db.py", line 321, in execute res = self._obj.execute(query, params) psycopg2.errors.UndefinedFunction: function jsonb_each_text(text) does not exist LINE 6: JOIN LATERAL jsonb_each_text(t."arch_db") v ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts. ``` Note:- One point fix should be in correct module but still it should be fix here because some time we do rename xmlid in pre of base if belongs to custom module upg-2799236 closes #270 Signed-off-by: Christophe Simonis (chs) <[email protected]>
1 parent fa6ed2a commit e6f36d0

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/util/records.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -808,15 +808,14 @@ def rename_xmlid(cr, old, new, noupdate=None, on_collision="fail"):
808808
# Adapting t-call and t-name references in views
809809
search_pattern = r"""\yt-(call|name)=(["']){}\2""".format(re.escape(old))
810810
replace_pattern = r"t-\1=\2{}\2".format(new)
811-
if version_gte("16.0"):
812-
arch_col = get_value_or_en_translation(cr, "ir_ui_view", "arch_db")
811+
if column_type(cr, "ir_ui_view", "arch_db") == "jsonb":
813812
replace_in_all_jsonb_values(
814813
cr,
815814
"ir_ui_view",
816815
"arch_db",
817816
PGRegexp(search_pattern),
818817
replace_pattern,
819-
extra_filter=cr.mogrify("{} ~ %s".format(arch_col), [search_pattern]).decode(),
818+
extra_filter=cr.mogrify("arch_db->>'en_US' ~ %s", [search_pattern]).decode(),
820819
)
821820
else:
822821
arch_col = "arch_db" if column_exists(cr, "ir_ui_view", "arch_db") else "arch"

0 commit comments

Comments
 (0)