Skip to Content
Menú
This question has been flagged
1 Respondre
1382 Vistes

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
Descartar
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
Descartar
Related Posts Respostes Vistes Activitat
1
de set. 23
1835
0
de jul. 25
774
1
de jul. 25
279
1
de maig 25
1514
1
de maig 25
1699