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

how to inherit view in existing module.

By
inam ul haq
on 12/22/15, 7:23 AM 514 views

i want to add an field in a view that exist in another module. 


0

Yenthe

--Yenthe--
6676
| 7 7 8
Turnhout, Belgium
--Yenthe--

My Odoo blog: http://www.odoo.yenthevg.com/

My Twitter: https://twitter.com/Yenthe666

Yenthe
On 12/22/15, 8:02 AM

Hi Inam,

This is done by creating a new module in which you add an XML file. In the XML file you add a record with an inherit_id which links to the original view. An example to inherit the form view from a product:

<?xml version="1.0" encoding="utf-8"?> <openerp> <data> <record id="view_product_form_inherit" model="ir.ui.view"> <field name="name">product.template.common.form.inherit</field> <field name="model">product.template</field> <field name="inherit_id" ref="product.product_template_form_view"/> <field name="arch" type="xml"> <xpath expr="//field[@name='sales_price']" position="after"> <field name="your_new_field"/> </xpath> </field> </record> </data> </openerp>

So what will this example do? It will inherit the product view from the module product and it will add a new field named 'your_new_field' right after the existing field 'sales_price'. The ref product.product_template_form_view links to the model product and searches for the view named 'product_template_form_view', which you can find here: https://github.com/odoo/odoo/blob/9.0/addons/product/product_view.xml#L69


Yenthe

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: 12/22/15, 7:23 AM
Seen: 514 times
Last updated: 12/22/15, 8:02 AM