i want to customize a wizard button to allow the selected items and change the done(Boolean) to True once i click the button. This is the sample view and the wizard button i had created.
And this is my code below in the view file:
<record model="ir.actions.server" id="make_it_done">
<field name="name">Make it done</field>
<field name="condition">True</field>
<field name="model_id" ref="model_todo_task"/>
<field name="type">ir.actions.server</field>
<field name="binding_model_id" ref="model_todo_task" />
<field name="code">
action = self.make_it_done()
</field>
</record>
And this is my model file:
from odoo import api,fields, models
from odoo.addons.base.res.res_request import referenceable_models
from odoo.exceptions import ValidationError
class TodoTask(models.Model):
def make_it_done(self):
print('Success!!')
I wish to create a wizard function that allow to update all of the selected items to "Done" (Just like the build in "Archive" function). But however based on my code, when i select the item and click the wizard function, it just do nothing.
This is the only response i received(The loading shown in picture above). Then all the checkbox would become unchecked.
I don't know what i've missed, but it just don't run the code. Please help me to solve this problem, thank you guys in advance!!
Maybe you can try to add a field named "state"
<field name="state">code</field>
inside the server action, it work for me