7.0 to 7.2: DETAIL: Key (model)=() is not present in table "ir_model"

When upgrading from 7.0 to 7.2, I have the same issue as described in Problem updating database from 6.8 to 7.0 (Docker) - #7, but that topic is closed, sadly.

I am using the docker-compose method. Here is the complete log:

$ env TRYTOND_DATABASE_URI="postgresql://postgres:*******@postgres" trytond-admin -v -d tryton --all
102 140478092652608 [2024-08-07 09:44:38,910] WARNING py.warnings /usr/lib/python3/dist-packages/passlib/utils/__init__.py:854: DeprecationWarning: 'crypt' is deprecated and slated for removal in Python 3.13
  from crypt import crypt as _crypt

102 140478092652608 [2024-08-07 09:44:39,483] WARNING py.warnings <frozen importlib._bootstrap>:1049: ImportWarning: PluginImportFixer.find_spec() not found; falling back to find_module()

102 140478092652608 [2024-08-07 09:44:39,589] WARNING py.warnings /usr/lib/python3/dist-packages/zeep/utils.py:1: DeprecationWarning: 'cgi' is deprecated and slated for removal in Python 3.13
  import cgi

102 140478092652608 [2024-08-07 09:44:41,913] WARNING py.warnings /usr/local/lib/python3.11/dist-packages/braintree/dispute.py:83: DeprecationWarning: Use ProtectionLevel enum instead
  warnings.warn("Use ProtectionLevel enum instead", DeprecationWarning)

102 140478092652608 [2024-08-07 09:44:41,930] WARNING py.warnings /usr/local/lib/python3.11/dist-packages/braintree/search.py:79: DeprecationWarning: Use protection_level parameter instead
  warnings.warn("Use protection_level parameter instead", DeprecationWarning)

Traceback (most recent call last):
  File "/usr/local/bin/trytond-admin", line 33, in <module>
    admin.run(options)
  File "/usr/local/lib/python3.11/dist-packages/trytond/admin.py", line 57, in run
    pool.init(update=options.update, lang=list(lang),
  File "/usr/local/lib/python3.11/dist-packages/trytond/pool.py", line 144, in init
    restart = not load_modules(
                  ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/trytond/modules/__init__.py", line 396, in load_modules
    _load_modules(update)
  File "/usr/local/lib/python3.11/dist-packages/trytond/modules/__init__.py", line 366, in _load_modules
    load_module_graph(graph, pool, update, lang, indexes)
  File "/usr/local/lib/python3.11/dist-packages/trytond/modules/__init__.py", line 198, in load_module_graph
    cls.__register__(module)
  File "/usr/local/lib/python3.11/dist-packages/trytond/model/fields/fmany2one.py", line 29, in __register__
    table_h.add_fk(
  File "/usr/local/lib/python3.11/dist-packages/trytond/backend/postgresql/table.py", line 430, in add_fk
    cursor.execute(
  File "/usr/local/lib/python3.11/dist-packages/trytond/backend/postgresql/database.py", line 71, in execute
    cursor.execute(self, sql, args)
psycopg2.errors.ForeignKeyViolation: insert or update on table "ir_action_wizard" violates foreign key constraint "ir_action_wizard_model_model_fkey"
DETAIL:  Key (model)=() is not present in table "ir_model".

Note that I did execute the manual migration steps for upgrading from 7.0 to 7.2, even though they did not seem to do anything:

postgres=# UPDATE ir_ui_view SET model = null WHERE model = '';
UPDATE ir_action_act_window SET res_model = null WHERE res_model = '';
UPDATE ir_action_wizard SET model = null WHERE model = '';
UPDATE ir_action_report SET model = null WHERE model = '';
UPDATE ir_action_report SET module = null WHERE module = '';
UPDATE 0
UPDATE 0
UPDATE 0
UPDATE 0
UPDATE 0

Anything else I can try?

Are you sure to have run the SQL queries on the right database? Because the error message seems to suggest that there are still record in ir_action_wizard that has a model equals to en empty string instead of NULL.

Indeed I executed the queries on the wrong database. I totally forgot that.

Everything is now working fine now, thanks a lot!

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.