I have created a button inside my view which triggers a method inside the module. However on clicking the button the temporary edited fields are saved and not reverted when clicking the 'Discard' button.
Here is the code for my view:
<form>
<sheet>
<group>
<field name="name" />
</group>
<button name="my_button" string="My Button" type="object" class="oe_edit_only" />
</sheet>
</form>
Once I click my_button
the field name
is saved in the database and the button Discard
has no effect any more.
How can I prevent Odoo from saving the temporary data when clicking my custom button?
(I'm working with Odoo10 but I guess it's the same for older versions of Odoo)
my_button
method do? You may be able to change your button into a Boolean field and make yourmy_button
method anonchange
. – traviswwidget="boolean_button"
but it is again surrounded by a button - and hence triggers the same behaviour (it saves my view). But maybe I can use this idea - showing a checkbox... – IstaLibera