Dear friends, I am tryng to set a date filter for yesterday under develop mode.
I edit search view and find today filter as default filter. It is like this
<filter string="Today" domain="[('date_order', '>=', datetime.datetime.now().strftime('%Y-%m-%d 00:00:00')),('date_order', '<=',datetime.datetime.now().strftime('%Y-%m-%d 23:23:59'))]"/>
I want to add yesterday filter, i thought just minus the current date. but i came with error. Anybody knows how to do?
Thanks.
<filter string="Yesterday" domain="[('date_order', '>=', (datetime.datetime.now()-datetime.timedelta(days=1)).strftime('%Y-%m-%d 00:00:00')),('date_order', '<=',(datetime.datetime.now()-datetime.timedelta(days=1)).strftime('%Y-%m-%d 23:23:59'))]"/>
error:Error: Failed to evaluate search criterions: {"code":400,"message":"Evaluation Error","data":{"type":"local_exception","debug":"Local evaluation failure\nTypeError: unsupported operand type(s) for +: 'datetime' and 'timedelta'\n\n{\"domains\":[[[\"state\",\"in\",[\"draft\",\"sent\",\"cancel\"]]],\"[('date_order', '>=', (datetime.datetime.now()+datetime.timedelta(days=-1)).strftime('%Y-%m-%d 00:00:00')),('date_order', '<=',datetime.datetime.now().strftime('%Y-%m-%d 23:23:59'))]\"],\"contexts\":[{\"lang\":\"en_US\",\"tz\":false,\"uid\":1,\"params\":{\"action\":290,\"page\":0,\"limit\":80,\"view_type\":\"list\",\"model\":\"sale.order\",\"_push_me\":false}},{}],\"group_by_seq\":[]}"}}