Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
15036 Lượt xem

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
Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất
<t t-foreach="request.env['my.model'].search([('date','>=', doc.date_start), 
'|',('date','&lt;', doc.date_end)],('date','=', doc.date_end)])" t-as="m">
 
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 10 22
5597
2
thg 3 21
3778
2
thg 3 21
8849
0
thg 12 20
3636
0
thg 5 20
2736