Hello,
I write this code which runs on "Record a Payment" on an invoice (if (object.state == 'paid')). It always write on object (10) but only works with project_toto (9) the second time it run
Do you have an idea ?
Thanks in advance
Benjamin
if (object != None):
if (object.state == 'draft'):
project_toto = env['sale.order'].search([('name','like',object.origin)]).x_wf1_project
object.write({'x_wf1_project': project_toto.id})
if (object.state == 'paid'):
project_toto = object.x_wf1_project
mailToPerso=[]
for consult in request.env['res.users'].search([('login','like','%')]):
if consult.x_category:
if project_toto.category in consult.x_category.split(';'):
mailToPerso.append(consult.login)
(9)project_toto.write({'wf1_step': 9})
(10)object.write({'x_originalmailto': ','.join(mailToPerso)})