Hey i have duplicated purchase.order and i have added approval matrix lines in another page in it and a Many2one field in header and when i select the field from header lines with the user names populate in the line view of PO. Then i press ask approval button it changes state now what i want is that
* When i press Approve button it should not change state at once but it should change state after every user in the matrix lines press that button and a comment wizard should open for all of them.
Here is my code
@api.multi
def button_approve(self):
self.ensure_one()
for rec in self.approval.matrix_order:
if rec.res_user:
self.write({'state': 'approved'})
return self._add_comment()
it works for one time only. I know the code is already wrong so please suggest something. Thanks