This question has been flagged

Hi,

I have a problem computed field write back to database. The version is 8.

I inherited the calendar.event

to introduce a computed field which is a boolean field and it is depends on attendee_ids.

If certain attendee in the attendee_ids the field will go true.

The field has a stored=True attribute.

The computation is good until the attendee_ids gets updated and the compute function recompute my field.

After the recomputation the ORM wants to write back the new value to the database, and BOOM error.

The so called "virtual_id" screwing up everything.

checked in the compute function the recordset already contains the virtual_ids, so the ORM trying to write back the changed field it throws an error..

I  logged several place the progress, it seems that the last place when the virtual_id can be converted back to the real_id is the write function.
I overrided the write to simply logg when it was called and ehat kind of id is there.

t seems that the write function called before the compute function (attendee_ids changed)  with real ids. That write is triggering triggering the compute func, in the compute func the recordset contains virtual_id!!! and after the field change it is going straight into DB without calling the write. So there is no way to convert back the virtual_id to real_id.

How can I solve this problem?


Avatar
Discard