I want to refresh the tree view of attendance when some record is deleted.
I'm trying unlink() function to refresh.
The .py code is
@api.multi
def unlink(self):
res = super(hr_attendance, self).unlink()
return {'type': 'ir.actions.client', 'tag': 'auto_refresh',}
I don't know how to call this in xml
I have tried
My xml code is
</record>
<record id="your_object_auto_refresh_dashboard" model="ir.actions.client">
<field name="name">refresh</field>
<field name="res_model">hr.attendance</field>
<field name="view_type">tree</field>
<field name="view_mode">tree</field>
<field name="tag">10</field>
<field name="usage">menu</field>
<field name="view_id" ref="view_attendance_who"/>
</record>
But its is not working.
How can I achieve this?
Is this is possible in odoo( refresh when record is deleted)?
Provide me some examples for this.
The python program I have changed
@api.multi
def unlink(self):
res = super(hr_attendance, self).unlink()
return {'type': 'ir.actions.client', 'tag': 'reload',}
When I delete some record from tree view This unlink() method is called but it is not refreshing the tree view.
I have called this function as button in the form view
<header>
<button name="unlink" string="Refresh" type="object" />
</header>
When I press this button in the form view it refresh the form view and delete the current record in the form view.
But what I want is when I delete the record in tree view the tree view should be refreshed.
How it can be achieved?