m3asmi
m3asmi

Reputation: 1262

how can we change the state value in a depends method?

how can we change the state value in a @api.depends method ? I tried the return {'value':{'stat':'done'}} and self.state='done' didn't work then self.browse(self.id).write({'state':'done' }) worked but on instant, we have to return to the list view or to reload the page to see the new state

Upvotes: 0

Views: 524

Answers (1)

Alpesh Valaki
Alpesh Valaki

Reputation: 1631

your problem can be resolved using this.

@api.onchange('your_field')
def your_method_name(self):
    self.state='done'
    return {
            'type': 'ir.actions.client',
            'tag': 'reload',
            }

Upvotes: 0

Related Questions