Migration from 3.6 to 6.2

I tried this suggestion (for both: ir_module and ir_module_dependency), but it doesn’t resolve this issue. Also after pasting this I get errors like:

psycopg2.IntegrityError: duplicate key value violates unique constraint "ir_module_module_pkey"
DETAIL:  Key (id)=(5) already exists.

Everytime I run the migration-process again the Key is incremented by 1. If I do the migration-process often enough at one point the migration finishes and I can connect via localhost.

found a solution, this worked for me:

SELECT setval('ir_module_dependency_id_seq', (SELECT MAX(id) FROM ir_module_dependency) + 1, true);
SELECT setval('ir_module_id_seq', (SELECT MAX(id) FROM ir_module) + 1, true);
1 Like

I was able to run the migration process succesfully. I am able to connect via localhost and via the desktop-application, but some parts are not working yet. Not sure what’s the best way to proceed.

This is one error I do not know how to handle. Maybe you have an idea.

  File "/home/lorenz/.pixi/envs/tryton/lib/python3.7/site-packages/tryton/gui/window/view_form/view/list.py", line 951, in __sig_switch
    if not self.screen.row_activate() and self.children_field:
  File "/home/lorenz/.pixi/envs/tryton/lib/python3.7/site-packages/tryton/gui/main.py", line 609, in menu_row_activate
    }, warning=False)
  File "/home/lorenz/.pixi/envs/tryton/lib/python3.7/site-packages/tryton/action/main.py", line 196, in exec_keyword
    Action._exec_action(action, data, context=context)
  File "/home/lorenz/.pixi/envs/tryton/lib/python3.7/site-packages/tryton/action/main.py", line 156, in _exec_action
    context_domain=action['context_domain'])
  File "/home/lorenz/.pixi/envs/tryton/lib/python3.7/site-packages/tryton/gui/window/window.py", line 32, in create
    win = Form(model, **attributes)
  File "/home/lorenz/.pixi/envs/tryton/lib/python3.7/site-packages/tryton/gui/window/form.py", line 43, in __init__
    self.screen = Screen(self.model, **attributes)
  File "/home/lorenz/.pixi/envs/tryton/lib/python3.7/site-packages/tryton/gui/window/view_form/screen/screen.py", line 139, in __init__
    self.switch_view()
  File "/home/lorenz/.pixi/envs/tryton/lib/python3.7/site-packages/tryton/gui/window/view_form/screen/screen.py", line 528, in switch_view
    self.load_view_to_load()
  File "/home/lorenz/.pixi/envs/tryton/lib/python3.7/site-packages/tryton/gui/window/view_form/screen/screen.py", line 554, in load_view_to_load
    self.add_view_id(view_id, view_type)
  File "/home/lorenz/.pixi/envs/tryton/lib/python3.7/site-packages/tryton/gui/window/view_form/screen/screen.py", line 567, in add_view_id
    return self.add_view(view)
  File "/home/lorenz/.pixi/envs/tryton/lib/python3.7/site-packages/tryton/gui/window/view_form/screen/screen.py", line 594, in add_view
    view = View.parse(self, xml_dom, view.get('field_childs'))
  File "/home/lorenz/.pixi/envs/tryton/lib/python3.7/site-packages/tryton/gui/window/view_form/view/__init__.py", line 45, in parse
    return ViewTree(screen, root, children_field)
  File "/home/lorenz/.pixi/envs/tryton/lib/python3.7/site-packages/tryton/gui/window/view_form/view/list.py", line 270, in __init__
    self.parse(xml)
  File "/home/lorenz/.pixi/envs/tryton/lib/python3.7/site-packages/tryton/gui/window/view_form/view/list.py", line 311, in parse
    self._parse_field(node)
  File "/home/lorenz/.pixi/envs/tryton/lib/python3.7/site-packages/tryton/gui/window/view_form/view/list.py", line 321, in _parse_field
    field = group.fields[name]

'code'

I see the same with email, category and vat_code.

The error is because you have some fields in your view that no longer existing in the modules. You should rename it to the proper field or remove them from the view.

Is there any documentation, on how these fields have changed and what I can use instead?

Well running standard tests on your module will catch those errors.
So we do not document every little change that can be found by tests.

One issue I am running into is that the classes TranslateFactory and Translator were removed from the trytond.report module in 5.0 and should be available in trytond.i18n (introduced in version 5.2). Is it correct that these classes are not available with version 5.0?

TranslateFactory is still there but it is supposed to be for internal use only.
And Translator is also still used but it is an import from genshi.filters and it should also be only for internal usage.

1 Like

For now I am using these imports:
from trytond.report.report import TranslateFactory

now I am running into this issue:

trytond_modules_paths = config.get('trytond', 'modules_path').split(',')
AttributeError: 'NoneType' object has no attribute 'split'

Does the way how to get the modules_path have changed in tryton5.0? Or do I have to set the modules_path in the tryton-config?

There has never been a modules_path configuration.

Anyway if you are using a configuration, you should always have a default value for it as the user may not set any value for it.

1 Like

Again I am running into an issue I do not understand:

  File "/trytond/ir/lang.py", line 313, in get
    ('code', '=', code),
ValueError: not enough values to unpack (expected 1, got 0)

Maybe you have a hint for me.

In 4.2, the language code has been simplified: https://code.tryton.org/tryton/commit/049635454a98.

I am sorry, but I do not see what I have to do to fix this error message.

You have somewhere some code that is probably still using old language code.

lang, = cls.search([ ('code', '=', code)])

the error-message reffers to this part of the code (tryton5.0 trytond/ir/lang.py 313). So here an empty collection is returned.

code = Transaction().language

with code = “de_DE”

And this is no more a valid language code.
Pretty sure you forgot: Migration — Tryton Documentation

thanks, setting the language to de fixes this issue

UPDATE ir_configuration SET language = 'de';

but now the gui shows some gui-elements in english…

edit: Solved it by renaming the translation files for the custom modules from de_DE.po to de.po and rerunning the tryton-admin migration.

Another issue I still have is that invoices are not shown, but there is no error reported. So maybe I need to rename something, I don’t know, maybe someone has a hint regarding this.

Does it mean the list of invoices is empty and includes no records even no broken records? maybe you can paste \d account_invoice of your db table.

exactly, no records are shown in the invoice tab.


                                                Table "public.account_invoice"
         Column          |              Type              | Collation | Nullable |                   Default                   
-------------------------+--------------------------------+-----------+----------+---------------------------------------------
 id                      | integer                        |           | not null | nextval('account_invoice_id_seq'::regclass)
 comment                 | text                           |           |          | 
 create_date             | timestamp(6) without time zone |           |          | 
 reference               | character varying              |           |          | 
 payment_term            | integer                        |           |          | 
 move                    | integer                        |           |          | 
 number                  | character varying              |           |          | 
 write_uid               | integer                        |           |          | 
 currency                | integer                        |           | not null | 
 description             | character varying              |           |          | 
 create_uid              | integer                        |           |          | 
 cancel_move             | integer                        |           |          | 
 state                   | character varying              |           |          | 
 party                   | integer                        |           | not null | 
 type                    | character varying              |           | not null | 
 company                 | integer                        |           | not null | 
 invoice_report_cache    | bytea                          |           |          | 
 journal                 | integer                        |           | not null | 
 invoice_date            | date                           |           |          | 
 write_date              | timestamp(6) without time zone |           |          | 
 account                 | integer                        |           | not null | 
 accounting_date         | date                           |           |          | 
 invoice_address         | integer                        |           | not null | 
 invoice_report_format   | character varying              |           |          | 
 is_marked               | boolean                        |           |          | false
 date_to_be_sent         | date                           |           |          | 
 beschreibung_intern     | character varying              |           |          | 
 anmerkung               | text                           |           |          | 
 kommission_text         | text                           |           |          | 
 invoice_report_cache_id | character varying              |           |          | 
 party_tax_identifier    | integer                        |           |          | 
 tax_identifier          | integer                        |           |          | 

the view for the invoices looks like this::

<?xml version="1.0"?>
<!-- This file is part of Tryton.  The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<tree string="Invoices">
    <field name="number"/>
    <field name="party"/>
    <field name="invoice_date"/>
    <field name="description"/>
    <field name="beschreibung_intern"/>
    <field name="untaxed_amount"/>
    <field name="tax_amount"/>
    <field name="total_amount"/>
    <field name="state"/>
    <field name="amount_to_pay_today"/>
    <field name="invoice_address" tree_invisible="1"/>
    <field name="is_marked" tree_invisible="1"/>
    <!-- <field name="email" tree_invisible="1"/> -->
    <!-- <field name="email_subject" tree_invisible="1"/> -->
</tree>

I already tried to comment some of the fields, but it seems to not be related to the fields listed there.

  • are you able to create a new invoice?
  • is the type of every account_invoice in or out?
  • is Administration / Models / Models / Data completely synced?
  • is there any old access right to records or models which restricts the access to the invoice?