Odoo 10 : How to increase the field width?

Viewed 5158

I have a form view which looks like this :

enter image description here

the xml looks like this :

<notebook>
<page>
<group string="In case of student employee or intern">   
     <field name="immatriculation" attrs="{'readonly':True}"/>
     <field name="studentStatus" attrs="{'readonly':True}"/>
     <field name="studentQuestionnaire" attrs="{'readonly':True}"/>
     <field name="studentOtherjobs" attrs="{'readonly':True}"/>
</group>
</page>
</notebook> 

I would like to increase the width of these fields so that All text (e.g. Confirmation of Student Status (Mandatory Internship) ) comes in a single line. I tried below but didnt see any changes in width :

<field name="studentStatus" attrs="{'readonly':True}" style="width:200px"/>

What is the right way to change the width of these fields inside a group?

4 Answers

Just put a <div/> tag it will render 50% space for label and 50% for fields Like this

<group string="In case of student employee or intern">
     <div /> <!-- here it is -->
     <field name="immatriculation" attrs="{'readonly':True}"/>
     <field name="studentStatus" attrs="{'readonly':True}"/>
     <field name="studentQuestionnaire" attrs="{'readonly':True}"/>
     <field name="studentOtherjobs" attrs="{'readonly':True}"/>
</group>

if you need space more then 50% then you have to apply style

When the checkbox string is long, I'd put the string to the right of the box.

Example

You may consider below view.

<group>
    <label string="Confirmation" for="confirm1" class="oe_inline"/>
    <div>
        <field name="confirm1" nolabel="1" class="oe_inline" modifiers="{}"/>
        <label string="blah blah blah" class="oe_inline"/>
    </div>
    <label string=" " for="confirm2" class="oe_inline"/>
    <div>
        <field name="confirm2" nolabel="1" class="oe_inline" modifiers="{}"/>
        <label string="blah blah blah" class="oe_inline"/>
    </div>
    <label string=" " for="confirm3" class="oe_inline"/>
    <div>
        <field name="confirm3" nolabel="1" class="oe_inline" modifiers="{}"/>
        <label string="blah blah blah" class="oe_inline"/>
    </div>
</group>

It's a bit tricky but you could try a simple solution by setting colspan to use the whole width of the notebook page.

<group string="In case of student employee or intern" colspan="4">

Try this one ... maybe u have to do it on every field

<field name="field1" style="width:40%%" />
Related