Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I add a header to a form that has already been defined in Odoo?

Tags:

odoo

openerp

Is it possible to inherit a form view and add a header to it? I've tried:

<field name="arch" type="xml">
  <xpath expr="//form" position="before">
    <header>
      <h1>hi</h1>
    </header>
  </xpath>
</field>

and

<form position="inside">
    <header>
        <h1>hi</h1>
    </header>
</form>

What can I do? I want to add buttons to the form in a nice manner without needing to redefine the whole form.

like image 274
Kit Sunde Avatar asked Dec 12 '14 11:12

Kit Sunde


2 Answers

<xpath expr="/form/*" position="before">
    <header>
        <h1>hi</h1>
    </header>
</xpath>

Note that this requires for the parent form to not be empty.

like image 69
Ludwik Trammer Avatar answered Oct 30 '22 14:10

Ludwik Trammer


This will take the current header and then replace it by the header you'll define here.

<xpath expr="//form/header" position="replace">
    <header>
        <h1>hi</h1>
    </header>
</xpath>
like image 30
JordyRitzen Avatar answered Oct 30 '22 16:10

JordyRitzen