diff --git a/trytond/backend/sqlite/database.py b/trytond/backend/sqlite/database.py index d689c0283a..1749cf0434 100644 --- a/trytond/backend/sqlite/database.py +++ b/trytond/backend/sqlite/database.py @@ -91,11 +91,16 @@ def date_trunc(_type, date): break else: return None - for attribute in [ - 'microsecond', 'second', 'minute', 'hour', 'day', 'month', 'year']: + for attribute, replace in [ + ('microsecond', 0), + ('second', 0), + ('minute', 0), + ('hour', 0), + ('day', 1), + ('month', 1)]: if _type.startswith(attribute): break - value = value.replace(**{attribute: 0}) + value = value.replace(**{attribute: replace}) return str(value)