Skip to Content
Menu
This question has been flagged
2 Replies
5740 Views

Hi,I have a button displayed on my tree view. I did'nt use the header for the button like the normal button. The purpose of the button is just to approve, reset to draft, refuse.

I want to ask how the button update or change automatically after clicking, the button is state workflow. I have the idea in the button that trigger the refresh of the default browser, but I don't know how to used it.


Thank you in advance for helping.


here's the picture


https://drive.google.com/file/d/12mRrQagTIOw2b6JYrgf2oV2XCMxmLhYE/view?usp=sharing

Avatar
Discard
Best Answer

Hello Francis Louie Del Rosario,

For that, you have to create method on button. Like for ex, I have create 1 method on Approved button which is shown below.

@api.multi

def approved_approval(self):
    self.field_name = 'field_value'
    model_obj = self.env['ir.model.data']
    data_id = model_obj._get_id('module_name', 'tree_view_id_of_supervisor_approval')
    view_id = model_obj.browse(data_id).res_id
    return {
            'type': 'ir.actions.client',
            'tag': 'reload',
            'name': _('Supervisor Approval'),
            'res_model': 'model.name',
            'view_type': 'tree',
            'view_mode': 'tree',
            'view_id': view_id,
            'target': 'current',
            'nodestroy': True,
        }


Hope it will works for you.

Thanks,

Avatar
Discard
Author

Hello Jignesh Mehta.,,

I saw this code before but i don't know how to use. :D

But now it works Thank you so much