diff --git a/trytond/trytond/ir/cron.py b/trytond/trytond/ir/cron.py index 9e78798f1f..a9067c8084 100644 --- a/trytond/trytond/ir/cron.py +++ b/trytond/trytond/ir/cron.py @@ -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): diff --git a/trytond/trytond/tests/test_ir.py b/trytond/trytond/tests/test_ir.py index 0857c4e653..68a2a8bba3 100644 --- a/trytond/trytond/tests/test_ir.py +++ b/trytond/trytond/tests/test_ir.py @@ -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