Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Cannot filter records in one2many

By
Buddhima
on 7/22/15, 3:18 AM 703 views

I'm trying to filter one2many records based on current date. This is my xml code

    <field name="record_ids" domain="[('end_date', '>', cur_date)]">

        <tree string="records_tree">

                <field name="record_id"/>

                <field name="record"/>

                <field name="start_date"/>

                <field name="end_date"/>

        </tree>

    </field>

cur_date is a functional field I added to get current date.

My problem is records are not filtered in the view. Also it doesn't show any error message

0
Jaakko Komulainen
On 7/22/15, 3:51 AM

You can get current date for your domain like this:

domain="[('end_date','&gt;',context_today().strftime('%%Y-%%m-%%d'))]" 

more examples: filter-by-date-of-today-with-a-delay

Hi. Thanks for the answer. I added this domain to view. Its still shows records without filtration

Buddhima
on 7/22/15, 5:21 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 7/22/15, 3:18 AM
Seen: 703 times
Last updated: 7/22/15, 3:51 AM