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()))]"
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
1
Reply
2074
Views
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.
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
2
Nov 24
|
84 | ||
|
2
Mar 24
|
574 | ||
|
0
Feb 24
|
1202 | ||
|
0
Jan 23
|
710 | ||
|
1
Nov 22
|
1770 |
It does help! Thanks