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 a form view in an other view?

By
amina
on 12/15/15, 12:32 PM 244 views

I want to inherit the form view of product_temlpate in a new view "centre_view" 

here is my.py file:

class centre(osv.osv):

_name = 'cvt.centre'

_description = '_Centre'

_inherit= 'product_template'

_columns = {

'name':fields.char('Nom_Centre', required=True)

}

and the xml file

<?xml version="1.0" encoding="utf-8"?>

<openerp>

<data>

<record model="ir.ui.view" id="view_centre_form">

<field name="name">centre.form</field>

<field name="model">cvt.centre</field>

<field name="inherit_id" ref="product.product_template_form_view"/>

<field name="arch" type="xml">

<form string="Product">

<field name='name'/>

</form>

</field>

</record>

<record model="ir.ui.view" id="view_centre_tree">

<field name="name">centre.tree</field>

<field name="model">cvt.centre</field>

<field name="inherit_id" ref="product.product_template_tree_view"/>

<field name="arch" type="xml">

<tree string="Product">

<field name='name'/>

</tree>

</field>

</record>

<record model="ir.actions.act_window.view" id="action_centre_form">

<field name="sequence" eval="1"/>

<field name="view_mode">form</field>

<field name="view_id" ref="view_centre_form"/>

<field name="act_window_id" ref="action_my_model_template"/>

</record>

<record model="ir.actions.act_window.view" id="action_centre_tree">

<field name="sequence" eval="1"/>

<field name="view_mode">tree</field>

<field name="view_id" ref="view_centre_tree"/>

<field name="act_window_id" ref="action_centre"/>

</record>

</data>

</openerp>

ParseError: "Invalid view definition

Details of error :
the field `warranty` doesn't existe

so 'warranty' is in the parente view

what could be wrong please?why new view doesn't show??

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/15/15, 12:32 PM
Seen: 244 times
Last updated: 12/15/15, 4:49 PM