Help

4

Field label not displayed

Avatar
omprakash

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

Avatar
Discard
3 Answers
19
Avatar
Anabela Damas
Best Answer

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 =)

4 Comments
Avatar
Discard
Avatar
omprakash
-

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

Avatar
Andreas Maertens
-

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

Avatar
Anabela Damas
-

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

Avatar
omprakash
-

Hi Andreas Maertens , Thanks for reply .

0
Avatar
testopenerp
Best Answer

Thanks for your answer Andreas Maertens. It is working.

1 Comment
Avatar
Discard
Avatar
sneha antony
-

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

0
Avatar
Yao
Best Answer

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*">

Avatar
Discard