December 2018
Beginner to intermediate
404 pages
10h 14m
English
Editing the <header> section in the form view, we'll add a button to make it easier to set a returned checkout as done:
<header>
<field name="state" invisible="True" />
<button name="button_done" type="object"
string="Return Books" attrs="{'invisible': [('state', 'in', ['new', 'done'])]}"
class="oe_highlight" />
</header>
Here, we add a Return Books button to the header that calls the button_done model method when clicked. Note that class="oe_highlight" can be used to highlight actions to the user. For example, when having several buttons to choose from, we can highlight the main or more usual action to perform next.
The attrs attribute is used to make this button invisible for the New and Done states. The condition to do ...
Read now
Unlock full access