Odoo Help


Add field to a new module

on 5/8/13, 8:39 AM 2,276 views

Hello everybody , i work with openerp v 7 i want to add a field , i've created a module named "champ" that contains the following files :


import test


"name" : "Test",
"version" : "7",
"author" : "me",
"website" : "",
"category" : "General",
"depends" : ["base"],
"description" : "",
"init_xml" : ["test_view.xml"],
"demo xml" : [],
"update_xml" : [ "test_view.xml"],
"installable": True,
"active": False,
"certificate" : ""


from openerp.osv import fields, osv
class Partner(osv.osv):
    _inherit = 'res.partner'
    _columns = {
        'champ' : fields.char('champ', size=128),



<?xml version="1.0"?>


<record model="ir.ui.view" id="view_partner_form2">
    <field name="name">res.partner.form.inherit2</field>
    <field name="model">res.partner</field>
<field name="type">form</field>
    <field name="inherit_id" ref="base.view_partner_form"/>
    <field name="arch" type="xml">
        <field name="phone" position="before">
<field name="champ"/>


the module is imported with success , but it is impossible for me to see my new fields (champ) When I redirected to the new module 'test' I can not find the extensions 'pyc' is that it may be my problem of this (compilation)?


Sudhir Arya (ERP Harbor Consulting Services)

--Sudhir Arya (ERP Harbor Consulting Services)--
| 6 8 8
Ahmedabad, India
--Sudhir Arya (ERP Harbor Consulting Services)--

• Co-Founder & Co-Owner at ERP Harbor Consulting Services

• ERP Consultant / ERP Customization / TechnoFunctional Expert

• Sound knowledge in Python, Odoo (Open ERP), XML, PostgreSQL

• Domain knowledge of Sale Management, Purchase Management, Warehouse Management, Manufacturing, Multi Company Configuration & Management, HR Management, Medical Management, Construction Management, Education Management, Point of Sale, Third Party Integrations

• Positive attitude and quick Learner

• Good analytical skill, quick bug and issue tracing and find the solution

• Good knowledge and experience in payment gateway integration with Odoo

• Ready to accept new challenges

• Active Memeber On Stackoverflow 




Sudhir Arya
ERP Harbor Consulting Services
Sudhir Arya (ERP Harbor Consulting Services)
On 5/8/13, 8:58 AM

Your code is fine. Did you restart your server?

Make following changes in __openerp__.py:

Remove following lines:

"init_xml" : ["test_view.xml"],
"demo xml" : [],
"update_xml" : ["test_view.xml"],
"active": False,

and add "data": ["test_view.xml"],

Restart server and then update module.

On 5/8/13, 11:24 AM

Even if I put "data": ["test view.xml"] But the same error appears he can not add the new field. error

(_inherit = 'Res.partner'             ^ IndentationError: expected an indented block)

I do not know for what reason, I have this problem, I use Open ERP 'Version 7.0-20130305-002149'

You must leave 4 space for indentation.

Sudhir Arya (ERP Harbor Consulting Services)
on 5/8/13, 11:32 AM

IndentationError means you have either a mix of tabs and spaces in your code or you missed an indentation level

FEScon, Felix Schubert
on 5/8/13, 11:32 AM

4 spaces!! this is weird It works perfectly. Thank you

on 5/8/13, 11:43 AM

problem solved thank you very much

on 5/8/13, 11:55 AM

My pleasure.

Sudhir Arya (ERP Harbor Consulting Services)
on 5/8/13, 11:56 AM

Your code is right but <field name="type">form</field> is depricated in 7.0.

It doesn't make any difference. It will only give you warning on console.

Sudhir Arya (ERP Harbor Consulting Services)
on 5/8/13, 9:49 AM

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/8/13, 8:39 AM
Seen: 2276 times
Last updated: 3/16/15, 8:10 AM