The Tryton developers released a new version of Tryton a few days ago. We try to keep up with the current stable version, so an upgrade is required. This posts lists the subtle changes that caused problems with our installation.
Before the upgrade
Custom and third-party modules
- Update dependencies to Tryton 4.2.
- Tryton 4.2 reworked the translation system which requires translation
files to be renamed. For all languages, rename the
.po
files as follows (See issue5443):en_US.po
→en.po
de_DE.po
→de.po
- …
Reports
- Reports use English as fallback language in case no other language is
defined. Due to the translation updates one needs to use
en
as fallback instead ofen_US
(See: issue5443).
Module: Party
-
The field
vat_code
was renamed totax_identifier
. Adapt to this change in case you are using this value in a report. -
The full address of a party now includes the party name. In our case the party name is duplicated on reports and we decided to go with this minimal patch for the party module to restore the old behaviour.
--- a/address.py 2016-12-13 10:16:26.720162514 +0100 +++ b/address.py 2016-12-13 10:16:34.872140410 +0100 @@ -143,8 +143,6 @@ } if context.get('address_from_country') == self.country: substitutions['country'] = '' - if context.get('address_with_party', False): - substitutions['party_name'] = self.party.full_name for key, value in substitutions.items(): substitutions[key.upper()] = value.upper() return substitutions
-
The report generation is broken for parties when certain countries are used in the address record. The following patch fixes the issue for Tryton 4.2 (See: issue6111):
diff -r 706751992f88 address.py --- a/address.py Mon Nov 28 16:19:18 2016 +0100 +++ b/address.py Thu Dec 15 13:08:35 2016 +0100 @@ -138,6 +138,11 @@ 'country': self.country.name if self.country else '', 'country_code': self.country.code if self.country else '', } + + # Map invalid substitutions district* to subdivision* on 4.2. + substitutions['district'] = substitutions['subdivision'] + substitutions['district_code'] = substitutions['subdivision_code'] + if context.get('address_from_country') == self.country: substitutions['country'] = '' if context.get('address_with_party', False):
Module: Stock
- Previous versions used
<product_name(move.product.id, shipment.delivery_address.party.lang and shipment.delivery_address.party.lang.code or 'en_US')>
in the report. This was changed tomove.product.rec_name
in the upstream delivery note report. Adapt accordingly in case you are using a custom delivery note report.
The upgrade
To get started, clone the running instance and test the upgrade with the clone. Our Tryton instance is installed in a virtual environment, so I started out by updating the version information in our Ansible role from 4.0 to 4.2. After that, Ansible can create the new virtual environment. Beware to upgrade all custom modules before this step as they need to depend on the new Tryton version.
Run pip freeze | grep "4.0"
in the virtual environment to make sure no
modules from 4.0 are lingering around.
Fix translations
In order to keep custom translations, one needs to convert them before performing the database upgrade. Connect to the database and update all translations:
UPDATE ir_translation SET lang = 'en' WHERE lang = 'en_US';
UPDATE ir_translation SET lang = 'de' WHERE lang = 'de_DE';
Upgrading the database
After the translation updates we are ready to upgrade the database:
$ trytond-admin --verbose --config trytond.conf --database <dbname> --all
The database upgrade completed successfully.
The aftermath
A few problems popped up after the upgrade:
- Duplicating a product requires “administration” permission (See: issue6115)
- Menus are always displayed in English in the Windows client (See: issue6116)
- The URL parameter does not open the referenced record (See: issue6119)
Additional information
Until next time.