Friday, October 6, 2023
1 change · master
Code cleanup and technical improvements
This update simplifies how Odoo stores and displays field change history in Chatter, reducing unnecessary stored data while keeping the same visible behavior. It also preserves past change history when fields are removed and improves tracking for relationship fields, making audit trails more reliable for users.
Original PR description
PURPOSE Simplify 'mail.tracking.value' model and code. Remove unnecessary fields and computation. Make code easier to handle and more batch-enabled. Keep tracking when removing fields. SPECIFICATIONS…
PURPOSE Simplify 'mail.tracking.value' model and code. Remove unnecessary fields and computation. Make code easier to handle and more batch-enabled. Keep tracking when removing fields. SPECIFICATIONS Remove 'tracking_sequence' on tracking values in DB. Consider insertion order should be done accordingly and display them based on ID DESC. Sequence is now used only for order records to insert in DB and can be used to resequence them using the field description at any time. Feature is still the same (order based on sequence) but without having to store the sequence itself. It was never updated anyway. Remove 'field_desc' and 'field_type' from 'mail.tracking.value' model. Those can be retrieved when necessary, as it is mainly used for frontend display in Chatter. Remove 'old_value_monetary' and 'new_value_monetary' as float value can be used instead. Rename 'field' to 'field_id' to better indicate it is a m2o, and not a char field holding a field name. When removing fields set the field to False instead. Add a new field to store fields information allowing to keep name, type and groups information to allow displaying removed tracking values. Use this field only when a field is removed to avoid duplicating field information when not necessary and polluting the table. Improve support of o2m / m2m tracking. Cleanup overall tracking code: try to make methods more consistent with I/O, cleanup formatting methods. While working on tracking, let us cleanup a bit tests and various code bits. Task-3345979 (Mail: Simplify tracking model)