maharshi maharshi - 3 months ago 30
Python Question

Label Not Showing in Odoo-9

I created a boolean field. The boolean is showing but the label isn't.

class product_pricelist_inherit(models.Model):
_inherit = 'product.pricelist'

myfield= fields.Boolean(string="Is this Pricelist Eligible for Me?")


XML:

<odoo>
<record id="product_product_pricelist_view" model="ir.ui.view">
<field name="model">product.pricelist</field>
<field name="inherit_id" ref="product.product_pricelist_view"/>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="myfield"/>
</field>
</field>
</record>
</odoo>

Answer

It will not show your field label because you have added field in <div>

Try with following code.

Replace

<field name="myfield"/>

with

<label for="myfield"/>
<field name="myfield"/>