跳至内容
菜单
此问题已终结
1 回复
1380 查看

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'))]"/>


形象
丢弃
最佳答案

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

形象
丢弃
相关帖文 回复 查看 活动
1
9月 23
1830
0
7月 25
767
1
7月 25
279
1
5月 25
1514
1
5月 25
1686