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.

4

Field label not displayed

By
omprakash
on 5/13/13, 2:26 PM 12,640 views

Hai Friends ,

Having doubt while creating custom module in OpenERP v7 . The field label not displayed after module install . These are my custom code ..

  1. __init__.py import notebook

2.__openerp__.py { "name" : "notebook", "version" : "0.1", "author" : "prakash", "website" : "http://www.test.com/", "category" : "Generic Modules/Others", "depends" : ["base"], "description" : "Simple demo module", "init_xml" : ["notebook_view.xml"], "demo_xml" : [], "update_xml" : [], "active": False, "installable": True }

3.notebook.py

from osv import fields, osv import time

class notebook(osv.osv): _name = "notebook" _description = "Simple Notebook" _columns = { 'title' : fields.char('Title', size=30, required=True), 'note' : fields.text('Note'), 'note_date' : fields.date('Date'), }

notebook()

  1. notebook_view.xml

    <openerp> <data> <record model="ir.ui.view" id="notebook_tree_view"> <field name="name">notebook.tree</field> <field name="model">notebook</field> <field name="type">tree</field> <field name="arch" type="xml"> <tree string="Notebook"> <field name="title"/> <field name="note"/> <field name="note_date"/> </tree> </field> </record>

    <record model="ir.ui.view" id="notebook_form_view">
        <field name="name">notebook.form</field>
        <field name="model">notebook</field>
        <field name="type">form</field>
        <field name="arch" type="xml">
            <form string="Notebook" version = "v7">
            <sheet>
                <field name="title"/>
                <field name="note"/>
                <field name="note_date"/>
                </sheet>
            </form>
        </field>
    </record>
    
    <record model="ir.actions.act_window" id="action_notebook_form">
        <field name="name">notebook</field>
        <field name="res_model">notebook</field>
    </record>
    
    <menuitem name="Notebook" icon="terp-project" id="notebook_menu"/>
    <menuitem id="notebook1_menu" name="Notebook1" parent="notebook_menu" />
    <menuitem name="Notes" parent="notebook1_menu" id="notebook_menu_mainform" action="action_notebook_form"/>
    

    </data> </openerp>

AFTER INSTALLATION COMPLETE : MODULE LIKE

http://s1309.photobucket.com/user/omprakashzeabalane/media/image_zps60b15f73.jpg.html

Is there any wrong ? Please clarify my doubt .

Thanks & Regards

OMPRAKASH.A

12
Anabela Damas
On 5/13/13, 3:49 PM

Hi,

I don't know much but I've noticed that if I add a field without being inside a group the label isn't displayed, so I do like this if I don't mind to grouping the fields:

 <record model="ir.ui.view" id="notebook_form_view">
    <field name="name">notebook.form</field>
    <field name="model">notebook</field>
    <field name="type">form</field>
    <field name="arch" type="xml">
        <form string="Notebook" version = "v7">
        <sheet>
          <group>
            <field name="title"/>
            <field name="note"/>
            <field name="note_date"/>
         </group>
        </sheet>
        </form>
    </field>
</record>

or if I don't want the fields in a group I do like this:

 <record model="ir.ui.view" id="notebook_form_view">
    <field name="name">notebook.form</field>
    <field name="model">notebook</field>
    <field name="type">form</field>
    <field name="arch" type="xml">
        <form string="Notebook" version = "v7">
        <sheet>
            <label for="title" string="what you want to appear for title"/>
            <field name="title"/>
            <label for="note" string="what you want to appear for note"/>
            <field name="note"/>
            <label for="note_date" string="what you want to appear for note_date"/>
            <field name="note_date"/>
         </group>
        </sheet>
        </form>
    </field>
</record>

Hope this helps you =)

Hi Anabela Damas , Thanks for your immediate reply . Its working for me .

omprakash
on 5/14/13, 2:37 AM

You should remove the <field name="type"> tag. That is depricated.

Andreas Maertens
on 5/14/13, 3:48 AM

You're welcome! If it works can you please accept the answer like a correct answer =)

Versão Integral, Anabela Damas
on 5/14/13, 5:59 AM

Hi Andreas Maertens , Thanks for reply .

omprakash
on 5/15/13, 3:19 AM
0
testopenerp
On 2/17/14, 8:10 AM

Thanks for your answer Andreas Maertens. It is working.

i tried all the above said things. Tried Anabela Damas's code(Both the codes),removed the <field name="type"> tag and deleted the "version" tag in the form field.But still the field labels are not displaying

sneha antony
on 2/28/14, 7:33 AM
0
Yao
On 7/8/13, 1:32 AM

I experienced the same issue. After deleting the "version" tag in the form field, the label is displayed as it should be.

<form string="Notebook" *version="v7*">

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: 5/13/13, 2:26 PM
Seen: 12640 times
Last updated: 2/4/16, 6:42 AM