We need a way to filter out and view opportunities that have been updated within the last 10 days. So I did the obvious and used the "Last Updated on" filter, however, now whenever we update the related contact details, the "Last Updated on" gets updated. This causes all opportunities that are related to that contact to show up in the filtered list. Is there a way to to filter just the CRM records that get updated?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Contabilidad
- Inventario
- PoS
- Proyecto
- MRP
Se marcó esta pregunta
2
Respuestas
143
Vistas
you can create a custom filter
write_date last update
("write_date", ">=", (context_today() - datetime.timedelta(days =10)).strftime("%Y-%m-%d"))
Hi,
The issue you're experiencing is common - when you filter by "Last Updated," Odoo shows all opportunities where any related record(including contacts, activities, or other linked records) was modified, not just the opportunity itself. This is why you're seeing opportunities appear in your filtered list even when only the related contact details were updated.
To filter only opportunities that were directly updated in the last 10 days, follow these steps:
1. Go to CRM → Opportunities
2. Click on Filters → Add Custom Filter
3. Configure the filter:
- Field: Last Updated (write_date)
- Operator: >=(greater than or equal)
- Value: 10 days ago
For developers or technical users, you can use these domain filters:
Simple domain: ("write_date", ">=", (context_today() - datetime.timedelta(days=10)).strftime("%Y-%m-%d"))
Programmatic filter: [('write_date', '>=', (datetime.datetime.now() - datetime.timedelta(days=10)).strftime('%Y-%m-%d 00:00:00'))]
XML view filter:
<filter string="Updated Last 10 Days"
name="last_10_days"
domain="[('write_date', '>=', (context_today() - datetime.timedelta(days=10)).strftime('%Y-%m-%d'))]"/>
By using `write_date` directly on the opportunity model instead of the generic "Last Updated" filter, you ensure only opportunities that were themselves modified appear in the results. This excludes opportunities that show up merely because a related contact, activity, or other linked record was updated. Save this filter by clicking the "Favorites" star icon and naming it "Updated Last 10 Days (Opportunities Only)" for quick access in the future.
Hope it helps
¿Le interesa esta conversación? ¡Participe en ella!
Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.
Inscribirse| Publicaciones relacionadas | Respuestas | Vistas | Actividad | |
|---|---|---|---|---|
|
|
0
dic 24
|
1846 | ||
|
|
0
sept 24
|
1874 | ||
|
|
1
mar 21
|
3028 | ||
|
|
2
ene 24
|
14049 | ||
|
|
2
dic 24
|
2354 |
I created the filter, but the problem is that whenever details are updated in the contact record, this triggers the CRM to show as being updated. I only want them to show as updated when CRM records are updated.
For some reason the forum isn't letting me comment to the posted answers, so forgive me for the reply and odd placement of my response.
I tried doing this multiple ways and each time I still get the same result (same as before). I tried going into CRM and creating a customer filter as you said and even copy and pasted your code into the code editor. This still brought up opportunities where the related records were changed. I tried going to settings/technical/user defined filters; created the filter and the resulting records it shows still included those same records.