This question has been flagged
1 Reply
6849 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:

File
"/opt/bitnami/apps/odoo/lib/odoo-8.0.post20151126-py2.7.egg/openerp/osv/expression.py",
line 308, in distribute_not
    elif token in DOMAIN_OPERATORS_NEGATION:
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
Avatar
Discard
Author Best Answer

[ '|', [ '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)

Avatar
Discard