Tryton - Issues

 

Issue8346

Title Load and update pycountry data from script
Priority feature Status resolved
Superseder Nosy List ced, pokoli, resteve, reviewbot, roundup-bot
Type performance Components country, currency, party
Assigned To ced Keywords review
Reviews 285501002
View: 285501002

Created on 2019-05-10.19:24:14 by ced, last changed by roundup-bot.

Messages
New changeset e05b79b89515 by Cédric Krier in branch 'default':
Rename language pattern into language_code
https://hg.tryton.org/tryton-env/rev/e05b79b89515
New changeset 2144c71d868d by Cédric Krier in branch 'default':
Rename language pattern into language_code
https://hg.tryton.org/modules/party/rev/2144c71d868d
New changeset bfab5eff21bd by Cédric Krier in branch 'default':
Load and update pycountry data from script
https://hg.tryton.org/tryton-env/rev/bfab5eff21bd
New changeset 6794fd13cb64 by Cédric Krier in branch 'default':
Load and update pycountry data from script
https://hg.tryton.org/modules/party/rev/6794fd13cb64
New changeset e83a477968ca by Cédric Krier in branch 'default':
Load and update pycountry data from script
https://hg.tryton.org/modules/currency/rev/e83a477968ca
New changeset 416223b2a093 by Cédric Krier in branch 'default':
Load and update pycountry data from script
https://hg.tryton.org/modules/country/rev/416223b2a093
msg50906 (view) Author: [hidden] (pokoli) (Tryton committer) (Tryton translator) Date: 2019-07-26.09:46:16
> There is no mechanism to force installing all extra dependencies with pip (like trytond_country[*]) so I hope we will remember when preparing the series.

Maybe it's worth to create an issue now and describe what packages should be installed. 

Otherwise I will try to remember also.
msg50898 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2019-07-26.09:32:42
> As a side note: We ensure that the new dependencies are installed on the 5.4 docker images.

There is no mechanism to force installing all extra dependencies with pip (like trytond_country[*]) so I hope we will remember when preparing the series.
msg50897 (view) Author: [hidden] (pokoli) (Tryton committer) (Tryton translator) Date: 2019-07-26.09:24:24
I've tested the patch and everything works as expected. So for me it's ready to push. 

As a side note: We ensure that the new dependencies are installed on the 5.4 docker images.
msg50852 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2019-07-24.18:30:37
Here is the patch: http://www.b2ck.com/~ced/issue8346.patch
msg50848 (view) Author: [hidden] (pokoli) (Tryton committer) (Tryton translator) Date: 2019-07-24.17:52:23
I tried to download the review but it's too large for download. Could you share it as patch file?
msg50829 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2019-07-24.11:23:48
I would like to push this change before the end of the month so the translations will be cleaned from the country and currency strings.
review285501002 updated at https://codereview.tryton.org/285501002/#ps281841002
msg50530 (view) Author: [hidden] (resteve) Date: 2019-07-07.21:17:47
Mistake in msg50529. Replace country is in party.address.format, not in party.address. Sorry.
msg50529 (view) Author: [hidden] (resteve) Date: 2019-07-07.21:14:12
IMHO relate country in party address is correct option because in reports you could browse data from the country (code, name...) and review285501002 you can't

Depends the country module is valid option.
review285501002 updated at https://codereview.tryton.org/285501002/#ps271751002
msg50527 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2019-07-07.19:54:49
Here is review285501002
For the symbol of currency as it is not provided by pycountry, I use forex-python. I think it is a good option as it may be the base for an automatic rate update.
msg50069 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2019-06-05.16:28:45
The party module depends on the country data for the format. So if we do not load the countries, it fails to create those records. I propose to replace the Many2One country on party.address.format by a char field with the country code. This way, it does not depend on the country records.
msg49709 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2019-05-13.11:04:28
It will be an intensive load and probably long process. I do not think it should be managed by a user request.
Also there is no point to run it again if the pycountry version did not change.
msg49707 (view) Author: [hidden] (pokoli) (Tryton committer) (Tryton translator) Date: 2019-05-13.08:51:24
I'm wondering if it won't be better to use a wizard on the server instead of a script so the users can update their own data without requiring the intervention of the system administrator.
msg49702 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2019-05-10.19:24:14
Managing those data inside the XML is quiet painful.
Instead I think we should use a script a little bit like the trytond_import_zip but using pycountry.

The script could manage the update using the ISO code as ID.

As it can be slow and not everybody needs every countries or currencies. I think the scripts could take as argument a list of ISO code to create/update.
History
Date User Action Args
2019-07-30 23:30:42roundup-botsetmessages: + msg50978
2019-07-30 23:30:38roundup-botsetmessages: + msg50977
2019-07-30 23:03:14roundup-botsetmessages: + msg50975
2019-07-30 23:03:10roundup-botsetmessages: + msg50974
2019-07-30 23:03:06roundup-botsetmessages: + msg50973
2019-07-30 23:03:01roundup-botsetstatus: testing -> resolved
nosy: + roundup-bot
messages: + msg50972
2019-07-26 09:46:17pokolisetmessages: + msg50906
2019-07-26 09:32:43cedsetmessages: + msg50898
2019-07-26 09:24:24pokolisetmessages: + msg50897
2019-07-24 18:30:37cedsetmessages: + msg50852

Showing 10 items. Show all history (warning: this could be VERY long)