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