Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
15147 มุมมอง

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
อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด
<t t-foreach="request.env['my.model'].search([('date','>=', doc.date_start), 
'|',('date','&lt;', doc.date_end)],('date','=', doc.date_end)])" t-as="m">
 
อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ต.ค. 22
5683
2
มี.ค. 21
3848
2
มี.ค. 21
8959
0
ธ.ค. 20
3745
0
พ.ค. 20
2841