Issue 11128

Title
The value "district with special status" for field "Type" in "Subdivision" is not one of the allowed options
Priority
bug
Status
resolved
Nosy list
ced, coogor, resteve, reviewbot, roundup-bot, yangoon
Assigned to
ced
Keywords
review

Created on 2022-01-11.10:25:16 by resteve, last changed 7 hours ago by roundup-bot.

Messages

New changeset 76cf8664834c by Cédric Krier in branch '6.2':
Limit pycountry up to version 20.7.3
https://hg.tryton.org/modules/country/rev/76cf8664834c

New changeset d66d52138b8d by Cédric Krier in branch '6.0':
Limit pycountry up to version 20.7.3
https://hg.tryton.org/modules/country/rev/d66d52138b8d
New changeset 4a61162d8175 by Cédric Krier in branch 'default':
Limit pycountry up to version 20.7.3
https://hg.tryton.org/tryton-env/rev/4a61162d8175

New changeset 4b31f280c1cf by Cédric Krier in branch 'default':
Manage unknown subdivision type
https://hg.tryton.org/tryton-env/rev/4b31f280c1cf

New changeset 8ac818dd8b34 by Cédric Krier in branch 'default':
Support pycountry 22.1.10
https://hg.tryton.org/tryton-env/rev/8ac818dd8b34
New changeset 5374d2ebccd5 by Cédric Krier in branch 'default':
Limit pycountry up to version 20.7.3
https://hg.tryton.org/modules/country/rev/5374d2ebccd5

New changeset 7168f1b5f966 by Cédric Krier in branch 'default':
Manage unknown subdivision type
https://hg.tryton.org/modules/country/rev/7168f1b5f966

New changeset b80f8e665d09 by Raimon Esteve in branch 'default':
Support pycountry 22.1.10
https://hg.tryton.org/modules/country/rev/b80f8e665d09
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2022-01-17.18:50:32

Here is review376481002 to limit version to older series.
Here is review397091002 which prevents future breakage.

Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2022-01-11.16:55:03

I think we need to find a way to not depend on such change of subdivision type.
Maybe the import script could set the type to None when it is an unknown type and output a warning about that.

Author: [hidden] (coogor)
Date: 2022-01-11.13:19:46
Author: [hidden] (resteve)
Date: 2022-01-11.13:16:52

msg73192

issue11128 is duplicated to issue11128 ? ;)

I found issue8344 but is oldest and not closed.

Author: [hidden] (yangoon) Tryton translator
Date: 2022-01-11.12:58:16

JFTR: duplicate of issue11128

Author: [hidden] (resteve)
Date: 2022-01-11.10:25:15

Since pycountry==22.1.10 [1] when try to import countries, crash with error:

The value "district with special status" for field "Type" in "Subdivision" is not one of the allowed options

The traceback:

$ ./trytond/trytond/modules/country/scripts/import_countries.py -c etc/server-montcau.cfg -d nan54country
Update countries
Update subdivisions
Traceback (most recent call last):
  File "./trytond/trytond/modules/country/scripts/import_countries.py", line 177, in <module>
    run()
  File "./trytond/trytond/modules/country/scripts/import_countries.py", line 173, in run
    main(args.database, args.config_file)
  File "./trytond/trytond/modules/country/scripts/import_countries.py", line 151, in main
    do_import()
  File "./trytond/trytond/modules/country/scripts/import_countries.py", line 159, in do_import
    subdivisions = update_subdivisions(countries, subdivisions)
  File "./trytond/trytond/modules/country/scripts/import_countries.py", line 105, in update_subdivisions
    Subdivision.save(records)
  File "/home/raimon/projectes/nandev/demo/proteus/proteus/__init__.py", line 103, in newfunc
    return self.func(owner, *args, **kwargs)
  File "/home/raimon/projectes/nandev/demo/proteus/proteus/__init__.py", line 847, in save
    ids = proxy.create(values, context)
  File "/home/raimon/projectes/nandev/demo/proteus/proteus/config.py", line 188, in __call__
    result = rpc.result(meth(*args, **kwargs))
  File "/home/raimon/projectes/nandev/demo/trytond/trytond/modules/country/country.py", line 241, in create
    return super(Subdivision, cls).create(vlist)
  File "/home/raimon/projectes/nandev/demo/trytond/trytond/model/modelsql.py", line 159, in wrapper
    return func(cls, *args, **kwargs)
  File "/home/raimon/projectes/nandev/demo/trytond/trytond/model/modelsql.py", line 677, in create
    cls._validate(sub_records)
  File "/home/raimon/projectes/nandev/demo/trytond/trytond/model/modelstorage.py", line 75, in wrapper
    return func(*args, **kwargs)
  File "/home/raimon/projectes/nandev/demo/trytond/trytond/model/modelstorage.py", line 1295, in _validate
    **error_args))
trytond.model.modelstorage.SelectionValidationError: The value "district with special status" for field "Type" in "Subdivision" is not one of the allowed options. - 

Since pycountry (changeset d8ea221 - Import data for iso-codes v4.8.0) [2], add new subdivision type: district with special status (pycountry/databases/iso3166-2.json)

Example:

{
  "code": "BA-BRC",
  "name": "Brčko distrikt",
  "type": "District with special status"
},

[1] https://pypi.org/project/pycountry/22.1.10/
[2] https://github.com/flyingcircusio/pycountry/commit/d8ea221b9f888a803715c294c2eeb194ad1462e4

History
Date User Action Args
2022-01-22 21:17:35roundup-botsetmessages: + msg73400
2022-01-20 23:10:17roundup-botsetmessages: + msg73361
2022-01-20 23:09:59roundup-botsetmessages: + msg73360
nosy: + roundup-bot
status: testing -> resolved
2022-01-17 19:12:37reviewbotsetmessages: + msg73270
2022-01-17 19:12:33reviewbotsetmessages: + msg73269
2022-01-17 19:12:30reviewbotsetmessages: + msg73268
2022-01-17 18:50:32cedsetassignedto: resteve -> ced
messages: + msg73267
reviews: 364601002 -> 364601002,376481002,397091002
2022-01-17 18:43:40cedsetstatus: chatting -> testing
2022-01-11 16:55:03cedsetmessages: + msg73196
nosy: + ced
2022-01-11 16:48:48cedlinkissue11078 superseder
2022-01-11 16:41:42cedsetmessages: - msg73194
2022-01-11 13:19:46coogorsetmessages: + msg73194
nosy: + coogor
2022-01-11 13:16:52restevesetmessages: + msg73193
2022-01-11 12:58:16yangoonsetmessages: + msg73192
nosy: + yangoon
2022-01-11 11:15:42reviewbotsetmessages: + msg73191
nosy: + reviewbot
2022-01-11 11:10:19restevesetassignedto: resteve
2022-01-11 11:10:07restevesetkeyword: + review
reviews: 364601002
2022-01-11 10:25:16restevecreate