Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Is it possible to inherit existing model without affect the default model? [Solved]

By
yopi
on 5/22/15, 6:10 AM 526 views

Hello,

I try to inherit the existing model, define some new fields and redefine the state of the default model also, but i do not want this new fields affect the default model (keeping the behaviour of the default model).

Is it possible to achieve that (besides copy the default model)?  

---------------------------------------------

Problem solved:

Use 'ir.action.act_window.view' in the action view definition and utilize a method named 'fields_view_get', you can override this method to modify the view that inherit another view without change/affect the default view.


Thanks

0
yopi
On 5/22/15, 6:37 AM

Hello Ivan,

Thanks for the quick response :).

Besides of copy the default model, is there another way to achieve that?

I inherit a sale.order model, and redefine the state fields. When i load/open the web, this model is already updated with the new state. (what i mean is the default state of sale.order model is not affect by the inherit model -- is it possible?) 

The way provided are either you copy the entire thing (prototyping), use delegation (which may make use harder to customize the parent model), or use the normal inheritance. If you need something else, you would need to develop your own inheritance mechanism.

Ivan
on 5/22/15, 6:57 AM

Thanks Ivan, it seems i need extra work to achieve it. :)

yopi
on 5/22/15, 7:39 AM
0

Ivan

--Ivan--
3210
| 5 3 6
Jakarta, Indonesia
--Ivan--
Ivan
On 5/22/15, 6:23 AM

Check out this documentation page on inheritence. There are various ways to inherit an object, depending on how do you want to "use" the field in the other class from the new class, that is provided by OpenERP.

For your purpose, maybe inheritance by prototyping is the most appropriate.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 5/22/15, 6:10 AM
Seen: 526 times
Last updated: 5/25/15, 4:47 AM