Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
1 Antworten
1081 Ansichten

Hi everyone,

I have a technical question about how Odoo handles indexes during search operations, and I’m hoping someone can clarify. Here’s the scenario:

  • In the stock.move model:
    • There’s a date field that is indexed.
  • In the stock.move.line model:
    • There’s a move_id field (Many2one relation to stock.move) that is indexed.
    • There’s a scheduled_date field that is a related field (related=move_id.date) and not stored in the database

My question is:

If I perform a search on the stock.move.line model using the scheduled_date field, will Odoo utilize the indexes on move_id and date, or will the search bypass these indexes due to the virtual nature of the scheduled_date field?

Thanks in advance for any insights!

Avatar
Verwerfen
Beste Antwort

I believe it does. And I don't see a related field as a virtual one. I guess that in the backend, related fields is just like an inner join field. In the front end, you can sort or group by the related field which wouldn't be possible with non store calculated field. If you want to be sure, maybe you can use some postgres profiling to understand what's inside the hood. For me, I don't care what index the Tesla uses, as long as it is a tesla and I enjoy driving it, I'd trust the rest to Elon's engineers.


Avatar
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
2
Okt. 22
4621
3
Nov. 19
3202
1
März 22
3003
0
Juli 25
924
1
Juli 25
736