Odoo Help


Using a Module to Customize Product Tree View

Jayson Wu
on 5/29/14, 3:04 AM 4,278 views


I'm trying to add another column on the Product Tree View by using a module.

However, I'm receiving this error message: except_orm: ('ValidateError', u'Error occurred while validating the field(s) arch: Invalid XML for View Architecture!')

This is what I got so far,

__openerp__.py => I already added 'product' on the 'depends' field.

mymodule.py =>

class custom_products(osv.osv):
    _name = "product.product"
    _inherit = "product.product"
    _columns = {
        'asupplier_code': fields.char('Supplier Code',size=32),
    _defaults = {
        'asupplier_code': '-',

mymodule_view.xml =>

<record model="ir.ui.view" id="attempt_2_form">
    <field name="name">product.product.tree</field>
    <field name="model">product.product</field>
    <field name="type">tree</field>
    <field name="inherit_id" ref="product.product_product_tree_view"/>
    <field name="arch" type="xml">
        <field name="default_code" position="after">
            <field name="assupplier_code"/>

From what I understand, (when trying to create a module that will edit an existing view)

<field name="name">product.product.tree</field> : I got the value from the View Name field

<field name="model">product.product</field> : I got it from the Object field

<field name="inherit_id" ref="product.product_product_tree_view"/> : The ref would be the name of the view that I wish to inherit right?

Is there something wrong with my understanding and code that results with a Invalid XML for View Architecture?


I finally found what's wrong. The field name has an extra 's'.

Jayson Wu
on 5/29/14, 3:22 AM

still not fixed though.

Jayson Wu
on 5/29/14, 3:23 AM
On 11/13/15, 7:02 PM

In odoo 9 (in you have you odoo server in other directory, just change the path to you odoo directory installation)

Create a new custom module:

cd /odoo/odoo-server <--Here inside is the odoo.py script to create a new custom module.

sudo ./odoo.py scaffold myproductviewtreelist /odoo/custom/addons <--This is my directory for my custom modules, this code create a new custom module

cd /odoo/custom/addons/myproductviewtreelist

Edit  __openerp__.py and save this settings:

locate: 'depends': ['base'], and add 'sale' like this:

'depends': ['base','sale'],

Edit emplates.xml and save this settings:

add this code: <--In my case a just want add the default_code field but you can add any field from your product form.

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

<field name="name">my.view.products.tree.inherit</field>

<field name="model">product.template</field>

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

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

<!-- Before the field 'name' i add the 'default_code' field, or any field from my product form-->

<field name="name" position="before">

<field name="default_code"/>




Go to top menu/apps on line then go to left menu update apps list, delete the filter in the search box app and put my and search, then install the module myproductviewtreelist


René Schuster

--René Schuster--
| 5 5 8
Weinheim, Germany
--René Schuster--

Challenge Everything!

René Schuster
On 6/4/14, 8:57 AM

In your __openerp__.py file you should add your custom view:

'data': [





| 5 4 6
Zagreb | Karlovac, Croatia

there is only 10 kind of people the ones that understand binary ... and others

On 6/4/14, 8:36 AM

In your module you have declared new class custom_products...

and in view you are calling odl class product.product...

rename your module class to :

class product_product (osv.osv):


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

1 follower(s)


Asked: 5/29/14, 3:04 AM
Seen: 4278 times
Last updated: 11/13/15, 7:57 PM