changeset e1f50cfa65b4 in tryton:5.0
details: https://hg.tryton.org/tryton?cmd=changeset;node=e1f50cfa65b4
description:
Use contextual date format to format datetime
When a datetime has min time, we must still use the contextual date
format
instead of the OS.
issue9622
review326131002
(grafted from 9095afd5c5a7fde37b2c63344620b2e99c9b5f00)
diffstat:
tryton/common/domain_parser.py | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diffs (21 lines):
diff -r 33fe99ca9bd6 -r e1f50cfa65b4 tryton/common/domain_parser.py
--- a/tryton/common/domain_parser.py Thu Sep 24 22:43:50 2020 +0200
+++ b/tryton/common/domain_parser.py Sat Oct 03 23:37:02 2020 +0200
@@ -527,14 +527,13 @@
def format_datetime():
if not value:
return ''
- format_ = (
- date_format(context.get('date_format')) + ' ' + time_format(field))
if not isinstance(value, datetime.datetime):
time = datetime.datetime.combine(value, datetime.time.min)
else:
time = timezoned_date(value)
- if time.time() == datetime.time.min:
- format_ = '%x'
+ format_ = date_format(context.get('date_format'))
+ if time.time() != datetime.time.min:
+ format_ += ' ' + time_format(field)
return datetime_strftime(time, format_)
def format_date():