简体   繁体   中英

How to add custom field attribute in odoo?

I want to add some custom attributes to the field label of xml, such as:

 <group>
   field name="a" custom="value"/>
 </group>

custom="value" is my custom label.

But it seems that odoo will erase the label it can not recognise.

How to add it?

Try with string attribute of field tag.

For example:

<field name="a" string="Custom Label">

All attributes of field tag.

For add a label in xml file :

<label for="a"/>

But for displaying "Custom Label", modifie in python file :

'a': fields.char('Custom Label', size=64, required=True),

You can use label tag, like this

<label for='a' string='custom label'></label>

<field name="a"/>

This will work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM