You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When applying function "delete_records_safely_by_xml_id" on views which are inherited by other views, we currently receive the following constraint error which lets the migration fail.
OpenUpgrade: Deleting record for XML-ID module.view
OpenUpgrade: Deleting record ir.ui.view#1234
odoo.sql_db: bad query: DELETE FROM ir_ui_view WHERE id IN (1234)ERROR: update or delete on table "ir_ui_view" violates foreign key constraint "ir_ui_view_inherit_id_fkey" on table "ir_ui_view"DETAIL: Key (id)=(1234) is still referenced from table "ir_ui_view".
Error deleting XML-ID module.view : ForeignKeyViolation('update or delete on table "ir_ui_view" violates foreign key constraint "ir_ui_view_inherit_id_fkey" on table "ir_ui_view"\nDETAIL: Key (id)=(1234) is still referenced from table "ir_ui_view".\n')
OpenUpgrade: XML-ID module.view changed to noupdate.
The current workaround is to first delete all the child records, which in fact is not a great solution since it is not really safe in terms of rollback capability etc.:
I understand, that deleting all the child records is may not what everybody wants, therefore it should be optional, e.g. by passing an additional parameter "delete_childs" to "delete_records_safely_by_xml_id".
The text was updated successfully, but these errors were encountered:
When applying function "delete_records_safely_by_xml_id" on views which are inherited by other views, we currently receive the following constraint error which lets the migration fail.
OpenUpgrade: Deleting record for XML-ID module.view
OpenUpgrade: Deleting record ir.ui.view#1234
odoo.sql_db: bad query: DELETE FROM ir_ui_view WHERE id IN (1234)ERROR: update or delete on table "ir_ui_view" violates foreign key constraint "ir_ui_view_inherit_id_fkey" on table "ir_ui_view"DETAIL: Key (id)=(1234) is still referenced from table "ir_ui_view".
Error deleting XML-ID module.view : ForeignKeyViolation('update or delete on table "ir_ui_view" violates foreign key constraint "ir_ui_view_inherit_id_fkey" on table "ir_ui_view"\nDETAIL: Key (id)=(1234) is still referenced from table "ir_ui_view".\n')
OpenUpgrade: XML-ID module.view changed to noupdate.
The current workaround is to first delete all the child records, which in fact is not a great solution since it is not really safe in terms of rollback capability etc.:
@openupgrade.migrate()
def migrate(env, version):
parent_id = env.ref("module.view")
env["ir.ui.view"].search([("inherit_id", "=", parent_id.id)]).unlink()
openupgrade.delete_records_safely_by_xml_id(
env,
[
"module.view",
],
)
I understand, that deleting all the child records is may not what everybody wants, therefore it should be optional, e.g. by passing an additional parameter "delete_childs" to "delete_records_safely_by_xml_id".
The text was updated successfully, but these errors were encountered: