Reputation: 27
I have to write domain for checking that the present date and time is between two Datetime fields. I wrote the domain, but it shows this error:
DataError: invalid input syntax for type timestamp: "date_from"
LINE 1: ...OM "hr_holidays" WHERE (("hr_holidays"."today" >= 'date_from...
^
My domain is:
<field name="domain">[('today','>=','date_from'),('today','<=','date_to')]</field>
today = fields.Datetime(default=fields.Datetime.now)`
Please help me.
Upvotes: 0
Views: 210
Reputation: 836
just remove the field of today, is pointless, and, in the xml:
<field name="domain">[('date_from', '>', ((context_today()+relativedelta(days=-1)).strftime('%Y-%m-%d'))), ('date_to', '<', ((context_today()+relativedelta(days=1)).strftime('%Y-%m-%d')))]"</field>
I added the relativedelta too so you can play with dates if you need.
Upvotes: 1