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
Asked
Active
Viewed 442 times
0

m3asmi
- 1,252
- 1
- 16
- 36
-
In v11 when you write state then you have to manually refresh page to see new state. By default it will not refreshed. – Keval Mehta Apr 02 '18 at 05:20
-
@KevalMehta but the `return` doesn't work – m3asmi Apr 02 '18 at 09:02
-
`return` is working in api.depends – Keval Mehta Apr 02 '18 at 11:05
1 Answers
0
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',
}

Alpesh Valaki
- 1,611
- 1
- 16
- 36
-
-
I cannot use the onchange because the function must listening to a related a the One2many field – m3asmi Apr 02 '18 at 09:03
-
suppose you are in sale order and you want to apply onchange on product_id from sale order @api.onchange('order_line.product_id') – Alpesh Valaki Apr 02 '18 at 09:09
-