Migration de tryton 3.6 vers 4.4

98 views
Skip to first unread message

Julien Fastré

unread,
Jun 8, 2017, 4:32:33 AM6/8/17
to tryton-fr
Bonjour,

Je suis en train de migrer notre installation de tryton de la version
3.6 vers la version 4.4.

J'ai recopié la base de donnée dans une nouvelle (pg_dump vers un
fichier sql, puis je le restaure), installé tryton 4.4 sur un nouveau
serveur, et j'ai effectué les migrations décrites dans les différents
threads ici : https://discuss.tryton.org/c/migration.

A savoir :


> clprod=# ALTER TABLE project_work DROP CONSTRAINT project_work_work_fkey;
> ERROR: relation "project_work" does not exist
> clprod=# UPDATE account_tax_template SET credit_note_base_sign = credit_note_base_sign * -1, credit_note_tax_sign = credit_note_tax_sign * -1;
> UPDATE 206
> clprod=# UPDATE account_tax SET credit_note_base_sign = credit_note_base_sign * -1, credit_note_tax_sign = credit_note_tax_sign * -1;
> UPDATE 106
> clprod=# DELETE FROM ir_module WHERE name IN ( 'webdav', 'calendar', 'calendar_todo', 'calendar_scheduling', 'calendar_classification', 'party_vcarddav');
> ERROR: relation "ir_module" does not exist
> LINE 1: DELETE FROM ir_module WHERE name IN ( 'webdav', 'calendar', ...
> ^
> clprod=# DELETE FROM ir_ui_view WHERE module IN ( 'webdav', 'calendar', 'calendar_todo', 'calendar_scheduling', 'calendar_classification', 'party_vcarddav');
> DELETE 0
> clprod=# DROP TABLE purchase_invoice_line_rel;
> ERROR: table "purchase_invoice_line_rel" does not exist

Puis j'ai lancé la migration avec

> trytond-admin -c /etc/trytond/config.ini -d clprod --all

Et c'est là que j'ai un problème:

> Traceback (most recent call last):
> File "/usr/local/bin/trytond-admin", line 21, in <module>
> admin.run(options)
> File "/usr/local/lib/python2.7/site-packages/trytond/admin.py", line 53, in run
> pool.init(update=options.update, lang=list(lang))
> File "/usr/local/lib/python2.7/site-packages/trytond/pool.py", line 155, in init
> lang=lang)
> File "/usr/local/lib/python2.7/site-packages/trytond/modules/__init__.py", line 451, in load_modules
> _load_modules()
> File "/usr/local/lib/python2.7/site-packages/trytond/modules/__init__.py", line 421, in _load_modules
> load_module_graph(graph, pool, update, lang)
> File "/usr/local/lib/python2.7/site-packages/trytond/modules/__init__.py", line 244, in load_module_graph
> cls.__register__(module)
> File "/usr/local/lib/python2.7/site-packages/trytond/modules/party/party.py", line 104, in __register__
> cursor.execute(*query)
> File "/usr/local/lib/python2.7/site-packages/trytond/backend/postgresql/database.py", line 60, in execute
> cursor.execute(self, sql, args)
> psycopg2.ProgrammingError: relation "party_party_lang" does not exist
> LINE 1: INSERT INTO "party_party_lang" ("party", "lang") SELECT "a"....

Est-ce que quelqu'un aurait une piste, quelque part ?

L'erreur complète sous postgres :

> ERROR: relation "party_party_lang" does not exist at character 13
> STATEMENT: INSERT INTO "party_party_lang" ("party", "lang") SELECT "a"."id", "a"."lang" FROM "party_party" AS "a"

Pour info, la connexion à la nouvelle base de donnée ne fonctionne pas,
j'ai l'erreur suivante :

> Traceback (most recent call last):
> File "/site-packages/trytond/wsgi.py", line 47, in dispatch_request
> return endpoint(request, **request.view_args)
> File "/site-packages/trytond/protocols/dispatcher.py", line 41, in rpc
> request, database_name, *request.rpc_params)
> File "/site-packages/trytond/protocols/dispatcher.py", line 54, in login
> database_name, user, parameters, language=language)
> File "/site-packages/trytond/security.py", line 26, in login
> user_id = User.get_login(loginname, parameters)
> File "/site-packages/trytond/res/user.py", line 558, in get_login
> user_id = func(login, parameters)
> File "/site-packages/trytond/res/user.py", line 572, in _login_password
> if cls.check_password(password, password_hash):
> File "/site-packages/trytond/res/user.py", line 592, in check_password
> return getattr(cls, 'check_' + hash_method)(password, hash_)
> File "/site-packages/trytond/res/user.py", line 629, in check_bcrypt
> return hash_ == bcrypt.hashpw(password, hash_)
> AttributeError: 'NoneType' object has no attribute 'hashpw'


Mais j'imagine que c'est normal: la migration n'a pas pu se terminer...

Cordialement,
Julien

--
Julien Fastré
Champs Libres
http://www.champs-libres.coop
+32 486 540 660

Champs Libres Cooperative SCRLFS
Rue Nanon 98 - 5000 Namur - Belgique
BE0541.427.670

Dominique Chabord

unread,
Jun 8, 2017, 4:42:16 AM6/8/17
to tryton-fr
2017-06-07 15:57 GMT+02:00 Julien Fastré <julien...@champs-libres.coop>:
> Bonjour,
>
> Je suis en train de migrer notre installation de tryton de la version
> 3.6 vers la version 4.4.
>
> J'ai recopié la base de donnée dans une nouvelle (pg_dump vers un
> fichier sql, puis je le restaure), installé tryton 4.4 sur un nouveau
> serveur, et j'ai effectué les migrations décrites dans les différents
> threads ici : https://discuss.tryton.org/c/migration.

je croyais qu'il fallait faire 3.6-> 3.8, 3.8 ->4.0, etc.. Est-ce que
je m'embête pour rien ?

Cédric Krier

unread,
Jun 8, 2017, 6:20:07 AM6/8/17
to tryton-fr
On 2017-06-07 15:57, Julien Fastré wrote:
> Puis j'ai lancé la migration avec
>
> > trytond-admin -c /etc/trytond/config.ini -d clprod --all
>
> Et c'est là que j'ai un problème:
>
> > Traceback (most recent call last):
> > File "/usr/local/bin/trytond-admin", line 21, in <module>
> > admin.run(options)
> > File "/usr/local/lib/python2.7/site-packages/trytond/admin.py", line 53, in run
> > pool.init(update=options.update, lang=list(lang))
> > File "/usr/local/lib/python2.7/site-packages/trytond/pool.py", line 155, in init
> > lang=lang)
> > File "/usr/local/lib/python2.7/site-packages/trytond/modules/__init__.py", line 451, in load_modules
> > _load_modules()
> > File "/usr/local/lib/python2.7/site-packages/trytond/modules/__init__.py", line 421, in _load_modules
> > load_module_graph(graph, pool, update, lang)
> > File "/usr/local/lib/python2.7/site-packages/trytond/modules/__init__.py", line 244, in load_module_graph
> > cls.__register__(module)
> > File "/usr/local/lib/python2.7/site-packages/trytond/modules/party/party.py", line 104, in __register__
> > cursor.execute(*query)
> > File "/usr/local/lib/python2.7/site-packages/trytond/backend/postgresql/database.py", line 60, in execute
> > cursor.execute(self, sql, args)
> > psycopg2.ProgrammingError: relation "party_party_lang" does not exist
> > LINE 1: INSERT INTO "party_party_lang" ("party", "lang") SELECT "a"....
>
> Est-ce que quelqu'un aurait une piste, quelque part ?

En fait, c'est un problème quand on migre à le 4.4 sans passer par la
4.2.
En fait, ce bout de migration de Party.__register__ devrait être bouger
dans PartyLang.__register__.
J'ai crée: https://bugs.tryton.org/issue6552

--
Cédric Krier - B2CK SPRL
Email/Jabber: cedric...@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

Julien Fastré

unread,
Jun 9, 2017, 4:46:33 AM6/9/17
to tryt...@googlegroups.com


Le 08/06/17 à 12:15, Cédric Krier a écrit :
Bonjour,

Je viens de passer patiemment de la version 3.6 à 3.8, puis de 3.8 à
4.0 et puis 4.2 (promis, j'attendrais plus autant de temps).

Tout s'est bien passé, à part un bug entre la 3.6 et 3.8, que j'ai
choisi d'ignorer, et ça semble être passé... [1]

Par contre je ne parviens pas à passer de la 4.2 à 4.4: voici
l'exception qui apparait :

> $ trytond-admin -c /etc/trytond/config.ini -d postgres --all
> Traceback (most recent call last):
> File "/usr/local/bin/trytond-admin", line 21, in <module>
> admin.run(options)
> File "/usr/local/lib/python2.7/site-packages/trytond/admin.py", line 53, in run
> pool.init(update=options.update, lang=list(lang))
> File "/usr/local/lib/python2.7/site-packages/trytond/pool.py", line 155, in init
> lang=lang)
> File "/usr/local/lib/python2.7/site-packages/trytond/modules/__init__.py", line 451, in load_modules
> _load_modules()
> File "/usr/local/lib/python2.7/site-packages/trytond/modules/__init__.py", line 421, in _load_modules
> load_module_graph(graph, pool, update, lang)
> File "/usr/local/lib/python2.7/site-packages/trytond/modules/__init__.py", line 244, in load_module_graph
> cls.__register__(module)
> File "/usr/local/lib/python2.7/site-packages/trytond/modules/account_invoice/account.py", line 112, in __register__
> fiscalyear.in_credit_note_sequence))))
> File "/usr/local/lib/python2.7/site-packages/trytond/backend/postgresql/database.py", line 60, in execute
> cursor.execute(self, sql, args)
> psycopg2.IntegrityError: null value in column "company" violates not-null constraint
> DETAIL: Failing row contains (1, 1, null, null, 4, 10, null, 2, null, 3, 2, null, 1).

Et l'erreur SQL complète :

> DETAIL: Failing row contains (1, 1, null, null, 4, 10, null, 2, null, 3, 2, null, 1).
> STATEMENT: INSERT INTO "account_fiscalyear_invoice_sequence" ("sequence", "fiscalyear", "period", "out_invoice_sequence", "out_credit_note_sequence", "in_invoice_sequence", "in_credit_note_sequence") SELECT 10, "a"."fiscalyear", "a"."id", COALESCE("a"."out_invoice_sequence", "b"."out_invoice_sequence"), COALESCE("a"."out_credit_note_sequence", "b"."out_credit_note_sequence"), COALESCE("a"."in_invoice_sequence", "b"."in_invoice_sequence"), COALESCE("a"."in_credit_note_sequence", "b"."in_credit_note_sequence") FROM "account_period" AS "a" INNER JOIN "account_fiscalyear" AS "b" ON ("b"."id" = "a"."fiscalyear")

S'agit-il d'un bug ou ais-je manqué une étape ?

Pour l'instant, je reste à la 4.2 parce que la cloture comptable c'est
jeudi...

Pour le reste, merci pour le travail autour de tryton.

Julien

PS: pour pouvoir migrer, j'ai construit une image docker de tryton, elle
est ici : https://framagit.org/champs-libres/docker-tryton

Je n'ai pas trouvé d'image docker existante. Si ça peut avoir un
intérêt, je peux en créer une et la mettre sur le hub docker.

Cédric Krier

unread,
Jun 9, 2017, 6:10:06 PM6/9/17
to tryt...@googlegroups.com
Je pense que c'est https://bugs.tryton.org/issue6526
Il n'a pas encore été backporté sur 4.4 mais ça ne devrait plus tarder.

> Pour l'instant, je reste à la 4.2 parce que la cloture comptable c'est
> jeudi...
>
> Pour le reste, merci pour le travail autour de tryton.
>
> Julien
>
> PS: pour pouvoir migrer, j'ai construit une image docker de tryton, elle
> est ici : https://framagit.org/champs-libres/docker-tryton
>
> Je n'ai pas trouvé d'image docker existante. Si ça peut avoir un
> intérêt, je peux en créer une et la mettre sur le hub docker.

Il y a un discussion ouverte https://discuss.tryton.org/t/build-docker-images/225
Ce n'est pas une tache facile et on veut être sur que le procédé soit
viable à long terme. Mais toute aide est la bien venue.

Julien Fastré

unread,
Jun 12, 2017, 4:19:11 AM6/12/17
to tryt...@googlegroups.com


Le 10/06/17 à 00:06, Cédric Krier a écrit :
> Je pense que c'est https://bugs.tryton.org/issue6526
> Il n'a pas encore été backporté sur 4.4 mais ça ne devrait plus tarder.

Ok, merci !

Julien
Reply all
Reply to author
Forward
0 new messages