[Erp5-dev] past values of a property

Jérome Perrin jerome at nexedi.com
Fri Jul 4 15:59:25 CEST 2008


Hello,

Le vendredi 04 juillet 2008 à 11:54 +0200, bartek a écrit :
> Hello,
> 
> A couple of would-be users of ERP5 asked me about possibility to
> store/retrieve past values of an object property, to be able to find out
> who changed it and when, and if necessary to rollback or use a past
> value "as of a given date". There is a number of common use cases for
> that, which I'll describe elsewhere.
> 
> Currently, the only way to retrieve a past value is the Zope's in-build
> mechanism, which is difficult to use and can serve only emergency
> purposes, and all the history is irrecoverably lost when database is
> packed.

For documents using edit_workflow workflow, history lines are clickable
and links to comparision page showing old, new and current values for
each property. This relies on Zope's history, so it's lost when packing.

> But I think it can be easily implemented using accessor
> generation and property sheets. What I mean is this: an application
> developer defines in a property sheet which properties should be
> "tracked", like this:
> 
> _trackable = ('title', 'vat_code')
> 
> This would modify behaviour of respective setters so that when a value
> changes, the change is stored in contained object similar to
> workflow_history (sthg like "property_history"). Then getters could
> accept an argument "at_date" - et ceatera.
> 
> What do you think?

Another way could be to do this is to use workflow variables on a
workflow with a workflow method transition on 'edit'.
For example, you define a workflow variable, named 'title' and you
configure this variable to get the value from here/getTitle and updates
on every transition.
It might not be show in Base_viewWorkflowHistory, because listbox
columns names are hardcoded, but this is easily fixable.

Jérome




More information about the Erp5-dev mailing list