Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
2 Replies
14443 Tampilan

Hi,

when I try to retrieve objects from model between two dated the second conditional gives an error, any idea why  "<" is not allowed?


<t t-foreach="request.env['my.model'].search([('date','>=', doc.date_start), 
('date','<=', doc.date_end)])" t-as="m">

Error:
lxml.etree.XMLSyntaxError: Unescaped '<' not allowed in attributes values, line 29, column 80
Avatar
Buang
Penulis Jawaban Terbai
<t t-foreach="request.env['my.model'].search([('date','>=', doc.date_start), 
'|',('date','&lt;', doc.date_end)],('date','=', doc.date_end)])" t-as="m">
 
Avatar
Buang
Jawaban Terbai

Hi,

If you are trying to fetch records from QWEB using ‘env’ may not work. So as a solution, you have to take the objects through JS as first and loop it from QWEB Template. 

If it's web template, you can try the code below : 

<t t-foreach="request.env[‘your.model'].search_read([('date','>=', doc.date_start), '|',('date','&lt;', doc.date_end)],('date','=', doc.date_end)])" t-as="m">


Regards

Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
2
Okt 22
5296
2
Mar 21
3444
2
Mar 21
8436
0
Des 20
3415
0
Mei 20
2504