Skip to Content
Menu
This question has been flagged
1 Reply
9829 Views
I'm trying to filter objects in the database that belong to the current year. I'm getting the above error, please help

<t t-foreach="o.search([(o.date_from.year, '=', datetime.datetime.now().year)])" t-as="year">     <t t-foreach="request.env['hr.payslip.line'].search([('slip_id', '=', year.id)])" t-as="lines">         <tr t-foreach="lines" t-as="line">
            <td>#value from line#</td>         </tr>     </t> </t>
Avatar
Discard
Best Answer

Hello Kelly,

Try this:

<t t-if="o.search([(o.date_from.year, '=', datetime.datetime.now().year)])">

    <t t-foreach="request.env['hr.payslip.line'].search([('slip_id', '=', year.id)])" t-as="lines">

                                    

        <tr t-foreach="lines" t-as="line">

            <td>#value from line#</td>

        </tr>

    </t>

</t>


Accept and upvote answer if helpful

Thanks and Regards 

Haresh Kansara

Avatar
Discard