# HG changeset patch # User Cédric Krier <ced@b2ck.com> # Date 1706612841 -3600 # Tue Jan 30 12:07:21 2024 +0100 # Node ID c2d266d5fd2591477a400f44d772e0dea499fee6 # Parent 7c8038af8ef811024851b568407b0af44be7be4b Add support for timestamp field as datetime in domain parser Closes #12776 diff --git a/sao/src/common.js b/sao/src/common.js --- a/sao/src/common.js +++ b/sao/src/common.js @@ -1578,6 +1578,7 @@ 'multiselection': complete_selection, 'reference': complete_reference, 'datetime': complete_datetime, + 'timestamp': complete_datetime, 'date': complete_date, 'time': complete_time }; @@ -1855,8 +1856,10 @@ operator = '='; } } - if (~['integer', 'float', 'numeric', 'datetime', 'date', - 'time'].indexOf(field.type)) { + if (~[ + 'integer', 'float', 'numeric', + 'datetime', 'timestamp', 'date', + 'time'].indexOf(field.type)) { if ((typeof value == 'string') && value.contains('..')) { var values = value.split('..', 2); var lvalue = this.convert_value(field, values[0], this.context); @@ -2088,6 +2091,7 @@ } } }; + converts.timestamp = converts.datetime; var func = converts[field.type]; if (func) { return func(); @@ -2204,6 +2208,7 @@ } } }; + converts.timestamp = converts.datetime; if (value instanceof Array) { return value.map(v => this.format_value(field, v)).join(';'); } else { diff --git a/tryton/tryton/common/domain_parser.py b/tryton/tryton/common/domain_parser.py --- a/tryton/tryton/common/domain_parser.py +++ b/tryton/tryton/common/domain_parser.py @@ -298,6 +298,7 @@ 'multiselection': convert_selection, 'reference': convert_selection, 'datetime': convert_datetime, + 'timestamp': convert_datetime, 'date': convert_date, 'time': convert_time, 'timedelta': convert_timedelta, @@ -402,6 +403,7 @@ 'multiselection': format_selection, 'reference': format_reference, 'datetime': format_datetime, + 'timestamp': format_datetime, 'date': format_date, 'time': format_time, 'timedelta': format_timedelta, @@ -465,6 +467,7 @@ 'multiselection': complete_selection, 'reference': complete_reference, 'datetime': complete_datetime, + 'timestamp': complete_datetime, 'date': complete_date, 'time': complete_time, } @@ -852,8 +855,9 @@ operator = '!=' else: operator = '=' - if field['type'] in ('integer', 'float', 'numeric', - 'datetime', 'date', 'time'): + if field['type'] in { + 'integer', 'float', 'numeric', + 'datetime', 'timestamp', 'date', 'time'}: if isinstance(value, str) and '..' in value: lvalue, rvalue = value.split('..', 1) lvalue = convert_value(field, lvalue, self.context)