understanding _history

46 views
Skip to first unread message

Paul J Stevens

unread,
Apr 8, 2011, 10:47:11 AM4/8/11
to tryton

Hi all,

What is the usage envisioned for the _history model?

I'm building the support ticket system as designed by C�dric and
Sharoon, but I can't find out how to access the history. Do I need to
write manual accessors?

The only examples I can find that do stuff like this are
sale_opportunity and ir.request, but they seem to do their own
implementation of historization.

So what is the purpose of this attribute?

Any pointers to documentation, examples or use-cases appreciated.

thanks.

--
________________________________________________________________
Paul Stevens paul at nfg.nl
NET FACILITIES GROUP GPG/PGP: 1024D/11F8CD31
The Netherlands________________________________http://www.nfg.nl

Sharoon Thomas

unread,
Apr 8, 2011, 10:57:29 AM4/8/11
to tryto...@googlegroups.com, Paul J Stevens
Hi,

I dont think there is any documentation at all about this feature.

When you add _history it creates a new table with model_name + __history and whenever the record is updated (create, write) a copy of the same is stored into the __history table.

If you read with _datetime specified in the context, then the record returned will be the record from history table as it was on that time instead of current one in the master table.

Also see the IRC logs of last few days as we have been discussing the history features with students of GSOC.

On Fri, Apr 8, 2011 at 10:47 AM, Paul J Stevens <pa...@nfg.nl> wrote:

Hi all,

What is the usage envisioned for the _history model?

I'm building the support ticket system as designed by Cédric and

Sharoon, but I can't find out how to access the history. Do I need to
write manual accessors?

The only examples I can find that do stuff like this are
sale_opportunity and ir.request, but they seem to do their own
implementation of historization.

So what is the purpose of this attribute?

Any pointers to documentation, examples or use-cases appreciated.

thanks.

--
 ________________________________________________________________
 Paul Stevens                                      paul at nfg.nl
 NET FACILITIES GROUP                     GPG/PGP: 1024D/11F8CD31
 The Netherlands________________________________http://www.nfg.nl

--
tryto...@googlegroups.com mailing list



--
Sharoon Thomas
Business Analyst & Open Source ERP Consultant
CEO @ http://openlabs.co.in

Cédric Krier

unread,
Apr 8, 2011, 11:06:13 AM4/8/11
to tryto...@googlegroups.com
On 08/04/11 16:47 +0200, Paul J Stevens wrote:
>
> Hi all,
>
> What is the usage envisioned for the _history model?

historize the modification of records.

> I'm building the support ticket system as designed by Cédric and


> Sharoon, but I can't find out how to access the history. Do I need to
> write manual accessors?
>
> The only examples I can find that do stuff like this are
> sale_opportunity and ir.request, but they seem to do their own
> implementation of historization.
>
> So what is the purpose of this attribute?

The attribute only active the historisation on the records of the Models but
the only way to access the historized data is by setting a _datetime in
context.
But in some cases like in sale_opportunity, you want to have read access on
those data (or a subset). For that you must create your own Model that will
use a SQL query as table. As this query is not generic and depends of the
business cases we can not provide a default one.

--
Cédric Krier

B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Tel: +32 472 54 46 59
Email/Jabber: cedric...@b2ck.com
Website: http://www.b2ck.com/

Paul J Stevens

unread,
Apr 8, 2011, 11:22:25 AM4/8/11
to tryto...@googlegroups.com
On 08-04-11 17:06, "C�dric Krier" <cedric...@b2ck.com>" wrote:
> On 08/04/11 16:47 +0200, Paul J Stevens wrote:
>>
>> Hi all,
>>
>> What is the usage envisioned for the _history model?
>
> historize the modification of records.

That's not a use-case, imo. More like a tautology. I meant: how can this
nice feature be made usable?

>> So what is the purpose of this attribute?
>
> The attribute only active the historisation on the records of the Models but
> the only way to access the historized data is by setting a _datetime in
> context.

Ah. Nice trick!

> But in some cases like in sale_opportunity, you want to have read access on
> those data (or a subset). For that you must create your own Model that will
> use a SQL query as table. As this query is not generic and depends of the
> business cases we can not provide a default one.

Thought so. No problem.

Thanks.

Cédric Krier

unread,
Apr 8, 2011, 11:38:23 AM4/8/11
to tryto...@googlegroups.com
On 08/04/11 17:22 +0200, Paul J Stevens wrote:

> On 08-04-11 17:06, "Cédric Krier" <cedric...@b2ck.com>" wrote:
> > On 08/04/11 16:47 +0200, Paul J Stevens wrote:
> >>
> >> Hi all,
> >>
> >> What is the usage envisioned for the _history model?
> >
> > historize the modification of records.
>
> That's not a use-case, imo. More like a tautology. I meant: how can this
> nice feature be made usable?

It is difficult to give you a "use-case" for a technical feature.
This feature is used in sale_opportunity, product_cost_history and also
account_invoice_history.

- sale_opportunity:

It allow to show modification of the opportunity (with a custom Model)

- product_cost_history:

It allow to display in list of graph view the modification of the product
cost price.

- account_invoice_history:

It allow to diplay the party record at the date when the invoice was
opened.

Reply all
Reply to author
Forward
0 new messages