-
Hi,
But I keep getting this error. From the logs I can see that the post-migration script was executed. Is there anything I'm missing? your help is appreciated. 2024-06-21 16:05:51,446 11539 INFO odoo_upgrade_15 odoo.modules.migration: module base: Running migration [14.0.1.3>] post-migrate
2024-06-21 16:05:51,449 11539 INFO odoo_upgrade_15 OpenUpgrade: base: post-migration script called with version 13.0.1.3
2024-06-21 16:05:51,454 11539 DEBUG odoo_upgrade_15 OpenUpgrade: 0 rows affected after 0:00:00.004776 running
WITH wrong AS (
SELECT imc.id
FROM ir_module_category imc
JOIN ir_module_category parent_imc ON parent_imc.id = imc.parent_id
JOIN ir_model_data imd ON (
imd.module = 'base' AND
imd.model = 'ir.module.category' AND imd.res_id = imc.id)
JOIN ir_model_data parent_imd ON (
parent_imd.model = 'ir.module.category' AND
parent_imd.res_id = parent_imc.id)
WHERE imd.name NOT LIKE (parent_imd.name || '%')
), to_update AS (
SELECT imc.id, max(parent_imd.name) as parent_name
FROM wrong imc
JOIN ir_model_data imd ON (
imd.model = 'ir.module.category' AND imd.res_id = imc.id)
LEFT JOIN ir_model_data parent_imd ON (
parent_imd.module = 'base' AND
parent_imd.model = 'ir.module.category' AND
parent_imd.id != imd.id AND
parent_imd.name != 'module_category_' AND
imd.name LIKE (parent_imd.name || '%'))
LEFT JOIN ir_module_category parent_imc ON parent_imd.res_id = parent_imc.id
GROUP BY imc.id
)
UPDATE ir_module_category imc
SET parent_id = parent_imd.res_id
FROM to_update
LEFT JOIN ir_model_data parent_imd ON (
parent_imd.model = 'ir.module.category' AND
parent_imd.name = to_update.parent_name)
WHERE to_update.id = imc.id
2024-06-21 16:05:51,483 11539 DEBUG odoo_upgrade_15 OpenUpgrade: 0 rows affected after 0:00:00.000396 running
INSERT INTO res_groups_users_rel (uid, gid)
SELECT rel.uid, 332
FROM res_groups_users_rel rel
WHERE rel.gid = 1
ON CONFLICT DO NOTHING
2024-06-21 16:05:51,486 11539 INFO odoo_upgrade_15 OpenUpgrade: base: loading 14.0.1.3/noupdate_changes.xml
2024-06-21 16:05:51,530 11539 INFO odoo_upgrade_15 OpenUpgrade: base: loading 14.0.1.3/group_allow_export_noupdate_changes.xml
2024-06-21 16:05:51,634 11539 INFO odoo_upgrade_15 odoo.modules.loading: Module base loaded in 5.42s, 9211 queries
2024-06-21 16:05:51,634 11539 INFO odoo_upgrade_15 odoo.modules.loading: 1 modules loaded in 5.42s, 9211 queries (+0 extra)
2024-06-21 16:05:51,644 11539 INFO odoo_upgrade_15 odoo.modules.loading: updating modules list
2024-06-21 16:05:51,645 11539 INFO odoo_upgrade_15 odoo.addons.base.models.ir_module: ALLOW access to module.update_list on [] to user __system__ #1 via n/a
have issue
2024-06-21 16:05:52,655 11539 ERROR odoo_upgrade_15 odoo.sql_db: bad query: UPDATE "ir_module_module" SET "category_id"=10,"menus_by_module"='',"reports_by_module"='',"views_by_module"='',"write_uid"=1,"write_date"=(now() at time zone 'UTC') WHERE id IN (1243)
ERROR: insert or update on table "ir_module_module" violates foreign key constraint "ir_module_module_category_id_fkey"
DETAIL: Key (category_id)=(10) is not present in table "ir_module_category".
Traceback (most recent call last):
File "/Users/upgrade/src/odoo/odoo/addons/base/models/ir_module.py", line 755, in update_list
mod.write(updated_values)
File "/Users/upgrade/src/odoo/odoo/models.py", line 3694, in write
field.write(self, vals[fname])
File "/Users/upgrade/src/odoo/odoo/fields.py", line 1582, in write
records.env['ir.translation'].search([
File ""/Users/upgrade/src/odoo/odoo/models.py", line 1719, in search
res = self._search(args, offset=offset, limit=limit, order=order, count=count)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/upgrade/src/odoo/odoo/addons/base/models/ir_translation.py", line 596, in _search
self.flush()
File "/Users/upgrade/src/odoo/odoo/models.py", line 5500, in flush
process(self.env[model_name], id_vals)
File "/Users/upgrade/src/odoo/odoo/models.py", line 5491, in process
recs._write(vals)
File "/Users/upgrade/src/odoo/odoo/models.py", line 3785, in _write
cr.execute(query, params + [sub_ids])
File "<decorator-gen-5>", line 2, in execute
File "/Users/upgrade/src/odoo/odoo/sql_db.py", line 101, in check
return f(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/upgrade/src/odoo/odoo/sql_db.py", line 301, in execute
res = self._obj.execute(query, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
psycopg2.errors.ForeignKeyViolation: insert or update on table "ir_module_module" violates foreign key constraint "ir_module_module_category_id_fkey"
DETAIL: Key (category_id)=(10) is not present in table "ir_module_category". |
Beta Was this translation helpful? Give feedback.
Answered by
HebaKM
Jun 30, 2024
Replies: 1 comment
-
After debugging I was able to solve this issue by adding the following to the
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
HebaKM
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
After debugging I was able to solve this issue by adding the following to the
ir_module_category_data.xml
file in the base module.