I want to, If i click the button, delete the data and turn back the tree view. I can delete the data with unlink method. But I can not do redirect to tree view. How can I do it?
This is my Code:
def action_delete(self):
vals = {
'ref_code': self.ref_code,
'product_name': self.product_name,
'product_description': self.product_description,
'teslim_alan': self.teslim_alan,
'teslim_eden': self.teslim_eden,
'quantity': self.quantity,
'price': self.price,
'unit_price': self.unit_price,
'warehouse_id': self.warehouse_id.id
}
self.env['scrap'].create(vals)
super(InventoryMenu, self).unlink()
My current URl: 'http://localhost:8069/web#id=21&cids=1&menu_id=385&action=507&model=inventory.menu&view_type=form'
My tree view URL: 'http://localhost:8069/web#cids=1&menu_id=385&action=507&model=inventory.menu&view_type=list'
If this is actually server action you are calling. Then you have to return new action.
You probably already have action for the inventory.menu
def action_delete(self):
#code to delete
action = self.env["ir.actions.actions"]._for_xml_id("your_module.your_action")
return action