@@ -1034,6 +1034,37 @@ and you can negate 1 using ``'!'`` (NOT).
1034
1034
1035
1035
.. automethod :: odoo.fields.Domain.validate
1036
1036
1037
+ .. _reference/orm/dynamic_values :
1038
+
1039
+ Dynamic time values
1040
+ ~~~~~~~~~~~~~~~~~~~
1041
+
1042
+ In the context of search domains, for
1043
+ :ref: `date and datetime fields <reference/fields/date >`, the value can be a
1044
+ moment relative to *now * in the timezone of the user. A simple language is
1045
+ provided to specify these dates. It is a space-separated string of terms.
1046
+ The first term is optional and is "today" (at midnight) or "now".
1047
+ Then, each term starts with "+" (add), "-" (subtract) or "=" (set), followed by
1048
+ an integer and date unit or a lower-case weekday.
1049
+
1050
+ The date units are: "d" (days), "w" (weeks), "m" (months), "y" (years),
1051
+ "H" (hours), "M" (minutes), "S" (seconds).
1052
+ For weekdays, "+" and "-" mean next and previous weekday (unless we are already
1053
+ in that weekday) and "=" means in current week starting on Monday.
1054
+ When setting a date, the lower-units (hours, minutes and seconds) are set to 0.
1055
+
1056
+ .. example ::
1057
+
1058
+ .. code-block :: python
1059
+
1060
+ Domain(' some_date' , ' <' , ' now' ) # now
1061
+ Domain(' some_date' , ' <' , ' today' ) # today at midnight
1062
+ Domain(' some_date' , ' <' , ' -3d +1H' ) # now - 3 days + 1 hour
1063
+ Domain(' some_date' , ' <' , ' =3H' ) # today at 3:00:00
1064
+ Domain(' some_date' , ' <' , ' =5d' ) # 5th day of current month at midnight
1065
+ Domain(' some_date' , ' <' , ' =1m' ) # January, same day of month at midnight
1066
+ Domain(' some_date' , ' >=' , ' =monday -1w' ) # Monday of the previous week
1067
+
1037
1068
Unlink
1038
1069
------
1039
1070
0 commit comments