Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
14398 Zobrazení

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
Zrušit
Autor Nejlepší odpověď
<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
Zrušit
Nejlepší odpověď

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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
2
říj 22
5265
2
bře 21
3422
2
bře 21
8410
0
pro 20
3388
0
kvě 20
2486