Discussion:
[Erp5-dev] past values of a property
bartek
2008-07-04 09:54:30 UTC
Permalink
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. 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?

Bartek
--
"feelings affect productivity. (...) unhappy people write worse
software, and less of it."
Karl Fogel, "Producing Open Source Software"
Jérome Perrin
2008-07-04 13:59:25 UTC
Permalink
Hello,
Post by bartek
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.
Post by bartek
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
_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

Loading...