2
votes

I have a field, in popup window, called "default_code" which correctly displayed the value 201-0147, picture attached. I want to have label "Item Number" just left of the field, on the same line. I tried setting attribute string to the "Item Number" (xml code attached) but it does not display. I know I can use <label> element, but, when displayed, it's displayed above the field, which I don't want. I want in line with field. What am I missing and what is the way to do it?

Thanks for your help!

Here is the popup window:

enter image description here

Here is the XML code:

<record id="replace_all_in_BOM_form" model="ir.ui.view">
    <field name="name">replace.all.in.BOM.form</field>
    <field name="model">product.template</field>
    <field name="priority" eval="20"/>
    <field name="type">form</field>
    <field name="arch" type="xml">  
        <field name="default_code" string="Item Number" readonly="1"        
             invisible="0" />
        </field> 
</record>
2
@Odedra Do you mean xml code (I think I posted it here) or python default_get code (the one that passes the default_code value to popup)?SmithMcPatrick

2 Answers

5
votes

Fields placed inside a <group> XML element will display labels by default.

<field name="arch" type="xml">  
  <group>
    <field name="default_code" string="Item Number" readonly="1"        
         invisible="0" />
  </group>
</field> 
3
votes

Or you can add a label tag like this:

<field name="arch" type="xml">  
     <label for="default_code" string="Item Number"/>
     <field name="default_code" readonly="1" 
            invisible="0" class="oe_inline"/>
</field>