Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
5736 Представления

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 Ответы Просмотры Активность
4
дек. 24
18292
1
янв. 23
1955
1
мая 24
3388
3
нояб. 23
17606
3
нояб. 24
25311