Odoo Help


Insert predefined XML into view

on 3/15/13, 10:33 AM 1,790 views

Is there a way to call predefined XML in a view? For example, I have a layout group that I want to use in several views and it would be nice to only have to define it once.


Mohammad Alhashash

--Mohammad Alhashash--
| 5 5 8
Giza, Egypt
--Mohammad Alhashash--


Mohammad Alhashash
On 3/15/13, 5:23 PM

You can create a view for an AbstractModel model that represents the common features of your models and inherit that view as a template for each model. You don't need to actually inherit the model itself.

View inheritance does not change the inherited view when the target model is different; it is applied on on the target model. You can have one view per model because all inherited views will be applied for each model regardless the view_id defined in action.

A similar concept is used in stock module in v7. The models stock.picking.out and stock.picking.out are created as prototype inheritance of stock.picking (but all models are sharing the same database table using _table = "stock_picking"). New views are created by inheriting from stock.picking views.

Mohammad - thanks for the response. I'm not sure I quite understand how to apply this; I am hoping to add these "templates" to existing views (Lead, Opportunity, Customer, etc) without changing any base views. Does this method work with those needs?

on 3/19/13, 10:03 AM

Yes. The key point is that inheriting view creates a new view instead of modifying the base view if the base model is different from the inherited view model.

Mohammad Alhashash
on 3/19/13, 5:16 PM

I'm not able to fully understand how I would go about implementing this on existing models; I'll keep playing but if you have any more examples you can outline I'd appreciate it. The stock.picking example is not straightforward to me because the objects seem to be designed around this method, not modified after the fact.

on 3/20/13, 12:04 PM

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


Asked: 3/15/13, 10:33 AM
Seen: 1790 times
Last updated: 3/16/15, 8:10 AM