Once a record is save, I need to make some changes in several fields. For theses computations, I also need the final ID value.
In which function should I put my code ? @filelds.depends(“id”) on_change_with_xxx() is not trigged when the id is computed. pre_validate() does not allow any changes…
First, I need to generate a sequential, unique ID. Ideally, it would be formated as : YYMM-ID.
I understand that I wouldn’t deal with ID, but i don’t know how to generate a unique ID…
Also, wen the record is modifyed, I also need to perform some updates on chlild records (compare dates and conditionnaly changes status).
You can do that by overriding ModelStorage.create and ModelStorage.write.
For the sequential number, you can use ir.sequence model to generate the ids with the proper configuration (using date etc.).
ModelStorage.save is syntactic sugar that call ModelStorage.create or ModelStorage.write. But there is no guarantee that ModelStorage.save will be called especially because it is not exposed to RPC.