Odoo Help


Creating "This week" or "Today +7 days" filter - not working

Zohair Iyaz
on 12/28/15, 12:49 AM 1,037 views

Model: Project.task
Custom Field: x_Planned_Start_Date (type:date)

Custom Filter #1:



 ['x_Task_Status', '=', 'Open'],
 [('x_Planned_Start_Date','<=', ((context_today()+datetime.timedelta(days=7)).strftime('%Y-%m-%d')))]

Error for Custom Filter # 1:

line 308, in distribute_not
TypeError: unhashable type: 'list'

Source: https://www.odoo.com/fr_FR/forum/help-1/question/filter-by-date-of-today-with-a-delay-8149

Custom Filter #2:


	['x_Task_Status', '=', 'Open'],
	['x_Planned_Start_Date', '<=', time.strftime('%Y-%m-%d %H:%M:%S',time.gmtime(time.time()+7243600))]


Custom Filter #2:

Uncaught Error: Failed to evaluate search criterions: 
{"code":400,"message":"Evaluation Error","data":{"type":"local_exception","debug":"Local evaluation failure\nAttributeError: object has no attribute 'gmtime'\n\n{\"domains\":[[],\"[\\n\\n\\t['x_Task_Status', '=', 'Open'],\\n\\t['x_Planned_Start_Date', '<=', time.strftime('%Y-%m-%d %H:%M:%S',time.gmtime(time.time()+7243600))]\\n]\"],\"contexts\":[{\"lang\":\"en_US\",\"tz\":\"Asia/Karachi\",\"uid\":1,\"params\":{\"action\":192,\"page\":0,\"limit\":80,\"view_type\":\"list\",\"model\":\"project.task\",\"_push_me\":false}},\"{}\"],\"group_by_seq\":[\"{}\"]}"}}

Source: https://www.odoo.com/fr_FR/forum/help-1/question/server-action-to-set-deadline-in-7-days-30277
Zohair Iyaz
On 1/8/16, 2:01 AM

[ '|', [ 'x_Planned_Start_Date', '=', (context_today()+relativedelta(days>1)).strftime('%Y-%m-%d'), ], [ 'x_Planned_Start_Date', '=', (context_today()+relativedelta(days<7)).strftime('%Y-%m-%d'), ] ]

Above works (tasks with Planned Start Date day after tomorrow and less than next week. User Requirement)

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 platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)


Asked: 12/28/15, 12:49 AM
Seen: 1037 times
Last updated: 9/14/16, 12:03 AM