0

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?

1
  • I want it to be converted to: <td data-field="hello-field" class="hello-class" custom="value">hello world</td> Commented Jul 21, 2016 at 1:54

3 Answers 3

1

Try with string attribute of field tag.

For example:

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

All attributes of field tag.

Sign up to request clarification or add additional context in comments.

1 Comment

Does not work for me. I tried to add string label but the field was converted to <td data-field="hello-field" custom="hello-class">hello world</td>, and string label was erased.
0

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),

2 Comments

you can also modify the label of a field from the xml view by setting the string attribute, look at @odedra's answer
Sorry, what I want is <td data-field="hello-field" custom="hello-class">hello world</td>
0

You can use label tag, like this

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

<field name="a"/>

This will work.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.