Excluding some changes from _history

I have a Tryton implementation that sets _history=True for project.work. It also has a custom numeric priority field on Work. There is a nightly cron job that cycles over any open Work instances and calculates the priority value, based on a number of factors. This priority value is used in ordering instances so user knows which Works should receive attention first.

Because we have a lot of Work instances (and they often remain open for many days), this has led to the Work history table becoming the largest table in our database, and has led to most of the history instances being priority changes that, IMO shouldn’t really be stored because they are really cached view data, rather than model data.

I am hoping to optimize this, and have two questions. (1) Will it break something if I deleted these priority-change-only history records? (2) Does it seem worthwhile to support a _history_ignore class attribute that takes a list of field names, such that writes that only change these fields do not create history instances? I believe that my implementation (a cached calculation used for ordering the view) is an appropriate use case for this feature.

Thanks, in advance, for your advice!

1 Like

No if you do not use them.

I do not think we want that in standard.
Indeed I think for your case the simplest solution is to store the cache of priority in an other model than project.work which is not historized and just define a Function field that get it.
Otherwise (but less recommended) you can update the priority field with an SQL query.

Thank you for the information!