Odoo - Is there a way to lazy load computed fields to speed up the form load time?

Viewed 53

I have several kanban views and form views that have a lot of computed fields that cannot be stored and significantly slow down page load time. Also, these fields cannot be stored as they require a real time computation. Is there any existing method to 'lazy load' these fields while the rest of the page opens?

Thanks for your input.

1 Answers

What about using 'lazy_property' decorator?

for example

from odoo import models
from odoo.tools import lazy_property

class MyModel(models.Model):
   ...
   ...
   
   @lazy_property
   def compute_a_field(self):
      # compute code here
      pass
Related