Skip to Content
Menu
Dette spørgsmål er blevet anmeldt
1 Svar
5739 Visninger

Hello,
Actually i'm working in a project ( i want to update a customer instead of creating it ) 
i did this code but it doesn't work any idea !! 

if record.email:

  contact = env['res.partner'].search([['email', '=', record.email]])


  if contact:

    for c in contact:

      if c.id != record.id :

        records.update({

          'mobile': record.mobile,

          'phone' : '22'

          

        })


Avatar
Kassér
Forfatter
@Akshay Babu yhanks , but instead of updating the contact .. another conctact created with updated info ... is there any solution ?
Bedste svar

To update an already created customer, you should be updating "c" instead of "records"

if contact:

    for c in contact:

      if c.id != record.id :

        c.write({

          'mobile': record.mobile,

          'phone' : '22'

          

        })


Avatar
Kassér
Related Posts Besvarelser Visninger Aktivitet
4
dec. 24
18298
1
jan. 23
1958
1
maj 24
3392
3
nov. 23
17610
3
nov. 24
25313