From b195b7f55a3dc51c03210a9607a183dafc8b3ce2 Mon Sep 17 00:00:00 2001 From: Bernat Brunet Date: Tue, 9 May 2023 09:06:14 +0200 Subject: [PATCH] Fix problem with strftime format, reducing the time needed to format standard time. When the %A or %B is not used. --- series | 2 ++ strftime_format.diff | 13 +++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 strftime_format.diff diff --git a/series b/series index a5670d3..5dd8e62 100644 --- a/series +++ b/series @@ -24,3 +24,5 @@ worker_logger.diff #[trytond] Move exception handling into transaction to keep t statement_of_account.diff # [account] Cumulate balance of previous fiscal years issue11731.diff # [currency] currency test don't pass when Currency Rates Source Not Ready (forex) + +strftime_format.diff # [ir] Fix problem with strftime format, reducing the time needed to format standard time. When the %A or %B is not used. diff --git a/strftime_format.diff b/strftime_format.diff new file mode 100644 index 0000000..ca5822f --- /dev/null +++ b/strftime_format.diff @@ -0,0 +1,13 @@ +diff --git a/tryton/trytond/trytond/ir/lang.py b/tryton/trytond/trytond/ir/lang.py +index d6e61e3599..4f3954beef 100644 +--- a/tryton/trytond/trytond/ir/lang.py ++++ b/tryton/trytond/trytond/ir/lang.py +@@ -542,6 +542,8 @@ class Lang(DeactivableMixin, ModelSQL, ModelView): + if isinstance(value, datetime.date): + for f, i, klass in (('%A', 6, Day), ('%B', 1, Month)): + for field, f in [('name', f), ('abbreviation', f.lower())]: ++ if f not in format: ++ continue + locale = klass.locale(self, field=field) + format = format.replace(f, locale[value.timetuple()[i]]) + if isinstance(value, datetime.time):