Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
2 Respostas
13747 Visualizações

Hi

odoo11

how get date from datetime field in domain of search view? (for compare with current_date)

how set " datetime_field" in below:

<filter name="today" string="Today" domain="[('datetime_field','=',current_date]"/>

Thanks


Avatar
Cancelar
Melhor resposta

Hi,

You can use the below:


<filter string="Today" domain="[('datetime_field', '&gt;=', datetime.datetime.combine(context_today(), datetime.time(0,0,0))),
('datetimefield', '&lt;=', datetime.datetime.combine(context_today(), datetime.time(23,59,59)))]" />


Avatar
Cancelar
Autor

Excellent

thanks so much for your help :)

Melhor resposta
You can use this if you want to filter Datetime field just by date:


​<field name="min_date" widget="date" filter_domain="[('min_date','>=',self+' 00:00:00'),('min_date','<=',self+' 23:59:59')]"/>


Avatar
Cancelar
Publicações relacionadas Respostas Visualizações Atividade
1
jan. 20
10934
1
dez. 20
21195
3
jan. 19
8293
22
dez. 23
49404
0
abr. 18
5569