Calculated field not updated in grid

Hello,

I noticed a bug with calculated field on grid.
I have a domain with 2 fields :

  • A one-to-many
  • An integer which is a calculated field to know the size of my one-to-amny relation
<![CDATA[
      return (myOneToMany== null)? 0 : myOneToMany.size();
]]>

The problem is that when we update the object, the change is not instantly deployed and grids display false values. The calculated field is always one step behind.

For example :

I have an object with a location :
image

From an other view, the grid display this :

Okay, first bug, it’s 0 and not 1.

Now, I will change my location from FS3 to FS4 and save :

image

My grid is now like this (one-step behind) :

So maybe 3 solutions :

  • It exist a better solution to calculate the sieze of my one2many field.
  • I’m not allowed to do this because point 1.
  • It’s an Axelor bug

grid component is not real-time so it’s not a bug.

Okay, but what is the best practice in my case with Axelor ?