Migration error to 7.6 renaming sale_line_account_tax

Hi,

When migrating our db from 6.0 to 7.6, the tryton-admin –all --activate-dependencies command leads to an error where Sale register tries to rename sale_line_account_tax into sale_line-account_tax.
Any idea on how to correct or circumvent this?

File “/Users/jcm/Sites/_tryton/tryton7.6/venv/lib/python3.13/site-packages/trytond/modules/sale/sale.py”, line 2301, in register
super().register(module)
~~~~~~~~~~~~~~~~~~~~^^^^^^^^
File “/Users/jcm/Sites/_tryton/tryton7.6/venv/lib/python3.13/site-packages/trytond/model/modelsql.py”, line 465, in register
history_table = cls.table_handler(module_name, history=True)
File “/Users/jcm/Sites/_tryton/tryton7.6/venv/lib/python3.13/site-packages/trytond/model/modelsql.py”, line 447, in table_handler
return backend.TableHandler(cls, history=history)
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
File “/Users/jcm/Sites/_tryton/tryton7.6/venv/lib/python3.13/site-packages/trytond/backend/table.py”, line 23, in new
instance._init(model, history=history)
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
File “/Users/jcm/Sites/_tryton/tryton7.6/venv/lib/python3.13/site-packages/trytond/backend/postgresql/table.py”, line 118, in _init
migrate_to_identity(self.table_name, ‘__id’)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
File “/Users/jcm/Sites/_tryton/tryton7.6/venv/lib/python3.13/site-packages/trytond/backend/postgresql/table.py”, line 53, in migrate_to_identity
cursor.execute(
~~~~~~~~~~~~~~^
“SELECT nextval(format(%s, %s))”, (‘%I’, previous_seq_name,))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/Users/jcm/Sites/_tryton/tryton7.6/venv/lib/python3.13/site-packages/trytond/backend/postgresql/database.py”, line 78, in execute
cursor.execute(self, sql, args)
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
psycopg2.errors.UndefinedTable: relation “sale_line-account_tax__history___id_seq” does not exist

It seems that your table sale_line-account_tax__history is missing a sequence for the column __id. Maybe it was renamed, in such case it must have the name expected by Tryton.

Thks Cédric,

It seems that the sequence exists and is already with a name in ‘_’ instead of ‘-’. Should I rename it to ‘sale_line-account_tax__history___id_seq‘?

psql# \ds sale_line*
                          List of relations
 Schema |                  Name                   |   Type   | Owner
--------+-----------------------------------------+----------+-------
 public | sale_line__history___id_seq             | sequence | jcm
 public | sale_line_account_tax__history___id_seq | sequence | jcm
 public | sale_line_account_tax_id_seq            | sequence | jcm
 public | sale_line_id_seq                        | sequence | jcm
 public | sale_line_moves_ignored_rel_id_seq      | sequence | jcm
 public | sale_line_moves_recreated_rel_id_seq    | sequence | jcm
(6 rows)

Probably if it is the one that is used for the default value of the __id column.