Community mailing list archives

Re: problem with view inheritance

Numa Extreme Systems, Gustavo Marino
- 03/12/2015 09:39:41
In the second view on product, there are two remarks:
  • you are inheriting from the product template view instead of the product one (in fact both views are derived from the same parent view)
  • you are modifing directly the product views (id = "product.product_template_custom_form_view") instead of defining new views in your module (if I understood right, two new ids)

Gustavo Adrian Marino


Mobile:  +54 911 5498 2515


Skype: gustavo.adrian.marino


<img border="0" width="213" height="94" src="cid:image001.jpg@01CC37F5.99B4CD20" alt="Descripción: Numa Logo V 1-0">

2015-03-12 9:12 GMT-03:00 Nuria Arranz Velazquez <>:

What colspan are you using on the other 3 fields?


On 12/03/15 10:32, Fabrizio Mancini wrote:
<blockquote cite="" type="cite">
Hi all,
i'm fighting against a problem with the views, and it's driving me crazy!
I'm trying to change the product view (Warehouse - Products- Products).
This is the code for the fields i want to add to the view.

class ProductTemplate(osv.osv):
    _inherit = 'product.template'
    _columns = {
        'anno': fields.integer('Anno')

    def _get_year(self, cr, uid, context=None):

    _defaults = {
        'anno': _get_year,

class ProductProduct(osv.osv):
    _inherit = 'product.product'
    _columns = {
        'codicebarre': fields.char('Codice a Barre GIG (code39)', size=12),
        'codicebarreext': fields.char('Codice a Barre Fornitore', size=150),
        'venduto_euro': fields.float('Venduto (Eur.)', digits=(14, 5))

Nothing complex.
Ok first of all i want to add the "anno" field in the product_template_form_view (i think this is the correct one). I place it after the first group in the "Information" page. In the link there is at the bottom the original view

<record model="ir.ui.view" id="product.product_template_custom_form_view">
    <field name="name">product.template.custom.form</field>
    <field name="model">product.template</field>
    <field name="mode">extension</field>
    <field name="inherit_id" ref="product.product_template_form_view" />
    <field name="arch" type="xml">
        <xpath expr="//page[@string='Information']/group[1]" position="after">
            <group colspan="4">
                    <field name="anno" string="Anno" />

and then the other fields. Here i inherit from the preceding view, but this is probably wrong?

<record model="ir.ui.view" id="product.product_product_custom_form_view">
    <field name="name">product.product.custom.form</field>
    <field name="model">product.product</field>
    <field name="mode">extension</field>
    <field name="inherit_id" ref="product.product_template_custom_form_view" />
    <field name="arch" type="xml">
        <xpath expr="//page[@string='Information']/group[2]/group[1]" position="inside">
                <field name="venduto_euro" />
        <xpath expr="//page[@string='Information']/group[2]" position="inside">
                <field name="codicebarre" />
                <field name="codicebarreext" />

But i can see the "anno" fields but not the other fields. 
The result is the same if i change the inherit_id field and the xpath expression.
So what i am doing wrong?
This is the screenshot
Thanks in advance, any help appreciated

Post to:

N. Arranz-Velazquez
OpusVL Odoo Specialist Team (OOST)

Drury House
Drury Lane
CV21 3DE

T: 01788 298 450

Post to: