Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
5735 มุมมอง

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'

          

        })


อวตาร
ละทิ้ง
ผู้เขียน
@Akshay Babu yhanks , but instead of updating the contact .. another conctact created with updated info ... is there any solution ?
คำตอบที่ดีที่สุด

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'

          

        })


อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
Odoo Installation Script แก้ไขแล้ว
4
ธ.ค. 24
18292
sub-modules odoo sh แก้ไขแล้ว
1
ม.ค. 23
1955
1
พ.ค. 24
3388
How to track One2many field in Odoo12? แก้ไขแล้ว
3
พ.ย. 23
17605
Error: Couldn't load module web แก้ไขแล้ว
3
พ.ย. 24
25311