I am trying to set state of another table while certain field is greater than a constant. But when I call method to change state another table, It does not work.
@api.multi
@api.depends('act_wt', 'a_wt')
def calc_diff(self):
self.wt_diff=0.0
if self.state == 'aload':
self.wt_diff = float(self.a_wt) - float(self.act_wt)
if self.wt_diff > 5:
self.reject_pack()
self.state = 'reject'
@api.multi
def reject_pack(self):
self.ensure_one()
rec = self.env['pack.packing'].search([('so_no', '=', self.so_no)])
if rec:
rec.state = 'rejected'
With this code method works with (self.state = 'reject') but doesnot work with self.reject_pack()