Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[13.0 -> 14.0] Migration fail due to "foreign key constraint does not exist" #2665

Closed
TheNick87 opened this issue Apr 19, 2021 · 8 comments
Closed

Comments

@TheNick87
Copy link

TheNick87 commented Apr 19, 2021

Hi,
i'm trying to migrate from Odoo 13 to Odoo 14 (i'm an Odoo newbie), but it fails when trying to reference at a not existing table (account_reconcile_model_line).
I also find that in file /odoo/addons/account/models/account_reconcile_model.py model AccountReconcileModelLine exists, so what is the problem?

Impacted versions: OpenUpgrade 14.0

Steps to reproduce: Just by executing procedure until it fail

Current behavior:

2021-04-16 14:19:45,506 12355 ERROR <db_name_masked> odoo.sql_db: bad query: ALTER TABLE "account_reconcile_model_analytic_tag_rel" ADD FOREIGN KEY ("account_reconcile_model_line_id") REFERENCES "account_reconcile_model_line"("id") ON DELETE cascade
ERROR: column "account_reconcile_model_line_id" referenced in foreign key constraint does not exist

2021-04-16 14:19:45,523 12355 WARNING <db_name_masked> odoo.modules.loading: Transient module states were reset
2021-04-16 14:19:45,526 12355 ERROR <db_name_masked> odoo.modules.registry: Failed to load registry
2021-04-16 14:19:45,526 12355 CRITICAL <db_name_masked> odoo.service.server: Failed to initialize database <db_name_masked>.
Traceback (most recent call last):
File "/opt/openupgrade/odoo-14/odoo/odoo/service/server.py", line 1198, in preload_registries
registry = Registry.new(dbname, update_module=update_module)
File "/opt/openupgrade/odoo-14/odoo/odoo/modules/registry.py", line 89, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)
File "/opt/openupgrade/odoo-14/odoo/odoo/modules/loading.py", line 451, in load_modules
force, status, report, loaded_modules, update_module, models_to_check)
File "/opt/openupgrade/odoo-14/odoo/odoo/modules/loading.py", line 348, in load_marked_modules
perform_checks=perform_checks, models_to_check=models_to_check
File "/opt/openupgrade/odoo-14/odoo/odoo/modules/loading.py", line 198, in load_module_graph
registry.init_models(cr, model_names, {'module': package.name}, new_install)
File "/opt/openupgrade/odoo-14/odoo/odoo/modules/registry.py", line 418, in init_models
self.check_foreign_keys(cr)
File "/opt/openupgrade/odoo-14/odoo/odoo/modules/registry.py", line 496, in check_foreign_keys
sql.add_foreign_key(cr, table1, column1, table2, column2, ondelete)
File "/opt/openupgrade/odoo-14/odoo/odoo/tools/sql.py", line 170, in add_foreign_key
cr.execute(query.format(tablename1, columnname1, tablename2, columnname2, ondelete))
File "", line 2, in execute
File "/opt/openupgrade/odoo-14/odoo/odoo/sql_db.py", line 101, in check
return f(self, *args, **kwargs)
File "/opt/openupgrade/odoo-14/odoo/odoo/sql_db.py", line 298, in execute
res = self._obj.execute(query, params)
psycopg2.errors.UndefinedColumn: column "account_reconcile_model_line_id" referenced in foreign key constraint does not exist

Expected behavior: Expect that it find table "account_reconcile_model_line"

Video/Screenshot link (optional):

@pedrobaeza
Copy link
Member

account module is not yet migrated.

@perrysmg
Copy link

perrysmg commented Aug 6, 2021

@pedrobaeza how can I skip the migration of "account" in the process?
I hit the same issue and am stuck in the migration process, what can I do to move forward to migrate other modules? since "account" module is not migrated yet and no way to migrate it.

@pedrobaeza
Copy link
Member

You can't skip anything. A DB is not able to be migrated if you don't have all the migration scripts for the whole module list.

@perrysmg
Copy link

perrysmg commented Aug 6, 2021

@pedrobaeza thanks for your reply!
but my question is: How can I do now if I am willing to migrate my v13 system to v14?
The community edition v13 I am working on is typical and seems the migration in this project is the only way if I am going to work on v14. and I assume that the migration should work because the v13 is typical and the community edition v14 (Sources) is downloaded from https://www.odoo.com/page/download.

@pedrobaeza
Copy link
Member

That's not possible for now if you have account installed. You have to wait.

@perrysmg
Copy link

perrysmg commented Aug 6, 2021

@pedrobaeza thanks for your information!
Does your team have plan to support 'account'? when might it be ready?

@pedrobaeza
Copy link
Member

See the progress in #2190

@perrysmg
Copy link

perrysmg commented Aug 6, 2021

@pedrobaeza thanks! I will track it there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants