osv_memory inherit

Asked by Ferdinand

Is it allowed to inherit a osv.osv_memory class ?

Question information

Language:
English Edit question
Status:
Answered
For:
Odoo Server (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Cristian Salamea (ovnicraft) said :
#1

Yes, new feature in v6 XD

Regards,

Revision history for this message
xrg (xrg) said :
#2

On Tuesday 28 December 2010, you wrote:
> New question #139378 on OpenObject Server:
> https://answers.launchpad.net/openobject-server/+question/139378
>
> Is it allowed to inherit a osv.osv_memory class ?

Yes, it is.

In fact, we are doing that in the installer wizards, and in account/report
wizards.

Revision history for this message
Cristian Salamea (ovnicraft) said :
#3

@xrg if i have mixed class my class(osv.osv, osv.osv_memory) is posible get in my class both *field types*, reading field types as combination between persisted and memory fields.?

Revision history for this message
xrg (xrg) said :
#4

On Tuesday 28 December 2010, you wrote:
> Question #139378 on OpenObject Server changed:
> https://answers.launchpad.net/openobject-server/+question/139378
>
> Cristian Salamea (Gnuthink) requested for more information:
> @xrg if i have mixed class my class(osv.osv, osv.osv_memory) is posible
> get in my class both *field types*, reading field types as combination
> between persisted and memory fields.?

I think that inheriting both osv.osv and osv.osv_memory is a shot in the foot.
Don't do that.

By design, you /can/ have one memory object that refers to a real osv.osv
record through a many2one field, but NOT the other way round.

Reasoning:
Remember that orm_memory objects have a short life and are automatically
cleared, they also have no referential integrity restrictions[1]. This means
that db-stored entries cannot have a reference to them, also cannot even
assume they exist.
I guess, this also would mean that an orm_memory _cannot_ either use the
"_inherits=..." feature to point to a normal object (because the memory one
will soon be vaccumed and leave the base one 'orphan').

[1] so far, in v6.0

Revision history for this message
Eduard Carreras i Nadal (ecarreras) said :
#5

OpenERP 5.0 docs[1] says:
"""provide important advantages over the pre-5.0 wizard system, with support features that were difficult to implement in wizards previously, such as:

1. inheritance
2. workflows
3. complex relation fields
4. computed fields
5. all kind of views (lists, graphs, ...)"""

Number 1 in 5.X is false... please make it clear...

[1] http://doc.openerp.com/v5.0/developer/3_10_wizard/index.html

Can you help with this problem?

Provide an answer of your own, or ask Ferdinand for more information if necessary.

To post a message you must log in.