Skip to Content
Menu
This question has been flagged
1 Reply
2074 Views

I try to define record rule with a domain that uses the time module that is available. The problem being that certain attributes of this python modules are not available.

For example time.time() is OK but time.ctime or time.localtime are not recognize.

In fact a get the following error:

ValueError: : "'wrap_module' object has no attribute 'ctime'" while evaluating
"[('date', '>=', time.ctime('%Y-%m-%d', time.time()))]"

Avatar
Discard
Author

It does help! Thanks

Best Answer

Hi, you cannot use notion of time in record rules.However, you can do that in Search view to filter records based on condition on the date.

Ex: 

filter string="Last Week" invisible="1" name="week" domain="[('date_order','>', (context_today() - datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"


Hope this helps.

Avatar
Discard
Related Posts Replies Views Activity
2
Nov 24
84
2
Mar 24
574
0
Feb 24
1202
0
Jan 23
710
1
Nov 22
1770