Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
7977 Lượt xem


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
Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 1 20
15411
16
thg 8 19
10375
1
thg 1 19
5588
5
thg 6 18
11005
0
thg 9 17
2628