diff --git a/company.py b/company.py index 4d9c602071..241971d704 100644 --- a/company.py +++ b/company.py @@ -4,14 +4,11 @@ from trytond.model import ModelSQL, ModelView, fields from trytond.pool import Pool from trytond.pyson import Eval, If from trytond.report import Report +from trytond.tools import timezone as tz from trytond.transaction import Transaction from trytond.wizard import Button, StateTransition, StateView, Wizard -try: - import pytz - TIMEZONES = [(x, x) for x in pytz.common_timezones] -except ImportError: - TIMEZONES = [] +TIMEZONES = [(z, z) for z in tz.available_timezones()] TIMEZONES += [(None, '')] Transaction.cache_keys.update({'company', 'employee'}) diff --git a/ir.py b/ir.py index 5508981fe7..98a449309d 100644 --- a/ir.py +++ b/ir.py @@ -1,13 +1,9 @@ # This file is part of Tryton. The COPYRIGHT file at the top level of # this repository contains the full copyright notices and license terms. -try: - import pytz -except ImportError: - pytz = None - from trytond.model import ( EvalEnvironment, ModelSQL, ModelView, dualmethod, fields) from trytond.pool import Pool, PoolMeta +from trytond.tools import timezone as tz from trytond.transaction import Transaction @@ -41,8 +37,8 @@ class Date(metaclass=PoolMeta): company_id = Transaction().context.get('company') if timezone is None and company_id: company = Company(company_id) - if company.timezone and pytz: - timezone = pytz.timezone(company.timezone) + if company.timezone: + timezone = tz.ZoneInfo(company.timezone) return super(Date, cls).today(timezone=timezone) diff --git a/setup.py b/setup.py index ed1273ed51..b25d9a4dad 100755 --- a/setup.py +++ b/setup.py @@ -140,9 +140,6 @@ setup(name=name, license='GPL-3', python_requires='>=3.7', install_requires=requires, - extras_require={ - 'timezone': ['pytz'], - }, dependency_links=dependency_links, zip_safe=False, entry_points="""