Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
5728 Lượt xem

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'

          

        })


Ảnh đại diện
Huỷ bỏ
Tác giả
@Akshay Babu yhanks , but instead of updating the contact .. another conctact created with updated info ... is there any solution ?
Câu trả lời hay nhất

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'

          

        })


Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
4
thg 12 24
18289
sub-modules odoo sh Đã xử lý
1
thg 1 23
1952
1
thg 5 24
3386
3
thg 11 23
17598
3
thg 11 24
25305