Skip to Content
Menu
This question has been flagged
1 Reply
6568 Views

Dear all,

I found a problem on Odoo 9 and I am unable to solve it.

I am using Odoo 9 because really need this API version for solving a request I have.

I have recreated the problem with a simple module in order to see if you can help me solve it.

The problem is related to a form view I wish to create.

Everything is ok with the form and the problem is that the field labels are missing as per the below image.


The code I have used for this form is:

1. The module .py:

from openerp import models
from openerp.osv import fields
class vetclicnic_animal(models.Model):
    _name='vetclinic.animal'
    _columns = {
        'name' : fields.char('Name', size=64, required=True),
        'birthdate' : fields.date('Birth Date'),
        'classification_id' : fields.many2one('vetclinic.classification','Classification'),
        'breed_id' : fields.many2one('vetclinic.breed','Breed'),
        'labels_ids' : fields.many2many('vetclinic.labels','rel_animal_labels','animal_id','labels_id',string='Tags'),
        'history' : fields.text('History'),
    }

2. The module .xml (for the form view)

<record id="vetclinic_animal_form_view" model="ir.ui.view">
        <field name="name">vetclinic.animal.form.view</field>
        <field name="model">vetclinic.animal</field>
        <field name="type">form</field>
        <field name="arch" type="xml">
            <sheet>
            <form string="Animal">
                <field name="name"/>
                <field name="birthdate"/>
                <field name="breed_id"/>
                <field name="classification_id"/>
                <field name="labels_ids" widget="many2many_tags"/>
                <field name="history"/>
            </form>
            </sheet>
        </field>
    </record>


When I create the "action" for the menu on the xml file, I can see the field labels but the field order is not the desired one and for this reason I need to define  form view.

Can anyone help me locate the problem on this form view?

Thank you very much

Regards

Paulo





Avatar
Discard
Best Answer

Hi,

wrap your fields in <group> tag. Besides, sheet should be within form. So, something like:

<form string="Animal">
    <sheet>
        <group>
            <field name="name"/>
            <field name="birthdate"/>
            <field name="breed_id"/>
            <field name="classification_id"/>
            <field name="labels_ids" widget="many2many_tags"/>
            <field name="history"/>
        </group>
    </sheet>
</form>

            

Avatar
Discard
Author

Thank you very much!

Related Posts Replies Views Activity
3
Feb 21
24795
0
Dec 20
2207
0
May 19
1763
3
Apr 18
6858
2
May 24
473