Skip to Content
Menu
This question has been flagged
1 Reply
1379 Views

Hi All

i am working on small module this is my first module i have created a search view as bellow but problem is when you click on late or today on activity menu all the activity will open and it will not filter the late or today activity i was wondering if some one can help me to solve it.

Best Regard







domain="[('my_activity_date_deadline', '<', context_today().strftime('%Y-%m-%d'))]"
help="Show all records which has next action date is before today"/>
domain="[('my_activity_date_deadline', '=', context_today().strftime('%Y-%m-%d'))]"/>
domain="[('my_activity_date_deadline', '>', context_today().strftime('%Y-%m-%d'))]"/>


Avatar
Discard
Best Answer

Hi,


It seems like there is a potential issue with the formatting of the domain in your search view. Additionally, you may need to handle the context in a way that dynamically updates the date values based on the selected filter.


Here's an example of how you can modify your search view to handle late and today activities:


<record id="view_activity_search" model="ir.ui.view">

<field name="name">crm.activity.search</field>

<field name="model">crm.activity</field>

    <field name="arch" type="xml">

        <search>

<filter string="Late Activities" name="late" domain="[('my_activity_date_deadline', '&lt;', context_today().strftime('%Y-%m-%d'))]" />

<filter string="Today's Activities" name="today" domain="[('my_activity_date_deadline', '=', context_today().strftime('%Y-%m-%d'))]" />

<filter string="Future Activities" name="future" domain="[('my_activity_date_deadline','&gt;', context_today().strftime('%Y-%m-%d'))]" />

        </search>

    </field>

</record>


Please make sure to replace 'crm.activity' with the actual model name


Hope it helps

Avatar
Discard
Related Posts Replies Views Activity
1
Sep 23
1827
0
Jul 25
766
1
Jul 25
279
1
May 25
1512
1
May 25
1684