Skip to content
Snippets Groups Projects
Commit d0e68c61 authored by Wolfgang Taferner's avatar Wolfgang Taferner Committed by fw-bot
Browse files

[FIX] account: method zipcode.isdigit is not sufficient enough


instead we do a simple try/except and catch the ValueError

closes odoo/odoo#40014

X-original-commit: ed20951a
Signed-off-by: default avatarNicolas Martinelli (nim) <nim@odoo.com>
parent 9f46dc70
No related branches found
No related tags found
No related merge requests found
......@@ -102,10 +102,12 @@ class AccountFiscalPosition(models.Model):
null_zip_dom = zip_domain = [('zip_from', '=', 0), ('zip_to', '=', 0)]
null_country_dom = [('country_id', '=', False), ('country_group_id', '=', False)]
if zipcode and zipcode.isdigit():
# DO NOT USE zipcode.isdigit() b/c '4020²' would be true, so we try/except
try:
zipcode = int(zipcode)
zip_domain = [('zip_from', '<=', zipcode), ('zip_to', '>=', zipcode)]
else:
if zipcode != 0:
zip_domain = [('zip_from', '<=', zipcode), ('zip_to', '>=', zipcode)]
except (ValueError, TypeError):
zipcode = 0
if state_id:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment