2

I am trying to add an XML attrs attribute that contains a < character:

<field name="discovery_note2" nolabel="1" placeholder="Note 2"
       attrs="{'invisible': ['|', ('is_discovery', '=', False), ('note_amount', '<', 0)]}"/>

But I am getting this error:

Error: XMLSyntaxError: Unescaped '<' not allowed in attributes values,

How can I pass the condition, if the note_amount field value is less than zero, then it should be invisible.

Note: note_amount is a computed field.

kjhughes
  • 106,133
  • 27
  • 181
  • 240
Omprakash Yadav
  • 107
  • 1
  • 3
  • 12

1 Answers1

3

Escape < as &lt; in XML because an unescaped < is expected to be the start of markup.

See also What characters do I need to escape in XML documents?

kjhughes
  • 106,133
  • 27
  • 181
  • 240