Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
5720 Tampilan

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
Buang
Penulis
@Akshay Babu yhanks , but instead of updating the contact .. another conctact created with updated info ... is there any solution ?
Jawaban Terbai

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
Buang
Post Terkait Replies Tampilan Aktivitas
4
Des 24
18279
1
Jan 23
1950
1
Mei 24
3382
3
Nov 23
17588
3
Nov 24
25286