Use tzinfo.tzname instead of key to display timezone on cron

key is a specific to ZoneInfo implementation when tzname is part tzinfo API.

Closes #12036
This commit is contained in:
Cédric Krier
2023-01-25 00:53:43 +01:00
parent e1361ddac3
commit debf8aabfa
2 changed files with 8 additions and 1 deletions
+1 -1
View File
@@ -103,7 +103,7 @@ class Cron(DeactivableMixin, ModelSQL, ModelView):
table_h.not_null_action('next_call', 'remove')
def get_timezone(self, name):
return tz.SERVER.key
return tz.SERVER.tzname(datetime.datetime.now())
@classmethod
def check_xml_record(cls, crons, values):
+7
View File
@@ -462,5 +462,12 @@ class IrCronTestCase(unittest.TestCase):
cron.compute_next_call(datetime.datetime(2022, 11, 6, 7, 30)),
datetime.datetime(2022, 11, 6, 8, 30))
@with_transaction()
def test_get_timezone(self):
"Test get_timezone"
cron = self._get_cron()
self.assertIsInstance(cron.get_timezone('timezone'), str)
del ModuleTestCase