Reputation: 321
I am trying to create a qweb report and I used the following snippet however I get an error that "global name 'partner' is not defined" while evaluating
<t t-foreach="partners" t-as="partner">
<t t-set="p_inovices" t-value="list( l.number for l in docs if l.partner_id.name == partner )" />
</t>
Upvotes: 2
Views: 1088
Reputation: 321
I got a solution using [ ] instead of using list() & everything worked fine
<t t-foreach="partners" t-as="partner">
<t t-set="p_inovices" t-value=" [ l.number for l in docs if l.partner_id.name == partner ] " />
</t>
also I'd like to mention that if I didn't use list comprehension it does work fine, as following:
<t t-foreach="partners" t-as="partner">
<t t-set="p_inovices" t-value=" list ( partner ) " />
</t>
I think it is because qweb foreach is working a little bit different
Upvotes: 0