Search code examples
odoo

Odoo - Find and remove <p> tag


I want to remove the <p> element:

<record model="ir.ui.view" id="helpdesk_support_form_view">
  <field name="name">Helpdesk form</field>
  <field name="model">helpdesk.support</field>
  <field name="arch" type="xml">
    <form>
      <sheet>
        <group>
          <group>
            <field name="total_spend_hours" widget="float_time" attrs="{'readonly': [('stage_type', '=', 'closed')]}"/>
    
            <p style="color:grey;" colspan="3">Some text here</p>
    
          </group>
        </group>  
      </sheet>
    </form>
  </field>
</record>

How can I achieve this?

I inherited the view and tried to add:

  <xpath expr="//p" position="replace">
    <span></span>
  </xpath>

But I get this error:

File "src/lxml/lxml.etree.pyx", line 3501, in lxml.etree._Validator.assert_ (src/lxml/lxml.etree.c:184715)
AssertionError: Element odoo has extra content: data, line 2

Thank you


Solution

  • Solution is:

    <xpath expr="//form/sheet/group/group/p" position="replace">
    <p></p>
    </xpath>