Crash on migrating while activating dependencies
when:
- make the changes to move a module from 7.0 to 7.2
- run the sql from the migration guide
- add stock_product_location_place on tryton.cfg
- executing:
trytond-admin -d projectA -u projectA -vv --activate-dependencies --all
the following raises:
97390 140448542556160 [2024-05-08 14:36:08,798] INFO trytond.modules stock_product_location_place:register stock.product.location.place
Traceback (most recent call last):
File "/home/vant/Documentos/GitLab/projectA/.venv/bin/trytond-admin", line 33, in <module>
admin.run(options)
File "/home/vant/Documentos/GitLab/projectA/.venv/lib/python3.10/site-packages/trytond/admin.py", line 57, in run
pool.init(update=options.update, lang=list(lang),
File "/home/vant/Documentos/GitLab/projectA/.venv/lib/python3.10/site-packages/trytond/pool.py", line 144, in init
restart = not load_modules(
File "/home/vant/Documentos/GitLab/projectA/.venv/lib/python3.10/site-packages/trytond/modules/__init__.py", line 382, in load_modules
_load_modules(update)
File "/home/vant/Documentos/GitLab/projectA/.venv/lib/python3.10/site-packages/trytond/modules/__init__.py", line 352, in _load_modules
load_module_graph(graph, pool, update, lang, indexes)
File "/home/vant/Documentos/GitLab/projectA/.venv/lib/python3.10/site-packages/trytond/modules/__init__.py", line 190, in load_module_graph
cls.__register__(module)
File "/home/vant/Documentos/GitLab/projectA/.venv/lib/python3.10/site-packages/trytond/model/modelsql.py", line 397, in __register__
super(ModelSQL, cls).__register__(module_name)
File "/home/vant/Documentos/GitLab/projectA/.venv/lib/python3.10/site-packages/trytond/model/model.py", line 127, in __register__
model_id = Model_.register(cls, module_name)
File "/home/vant/Documentos/GitLab/projectA/.venv/lib/python3.10/site-packages/trytond/ir/model.py", line 103, in register
cursor.execute(*ir_model.insert(
File "/home/vant/Documentos/GitLab/projectA/.venv/lib/python3.10/site-packages/trytond/backend/postgresql/database.py", line 71, in execute
cursor.execute(self, sql, args)
psycopg2.errors.ForeignKeyViolation: insert or update on table "ir_model" violates foreign key constraint "ir_model_module_name_fkey"
DETAIL: Key (module)=(stock_product_location_place) is not present in table "ir_module".
If instead I do it in two steps:
- make the changes to move a module from 7.0 to 7.2
- run the sql from the migration guide
- executing:
trytond-admin -d projectA -u projectA -vv --all
- add stock_product_location_place on tryton.cfg
- executing:
trytond-admin -d projectA -u projectA -vv --activate-dependencies --all
There is no error.