Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
5712 Widoki

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'

          

        })


Awatar
Odrzuć
Autor
@Akshay Babu yhanks , but instead of updating the contact .. another conctact created with updated info ... is there any solution ?
Najlepsza odpowiedź

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'

          

        })


Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
4
gru 24
18271
1
sty 23
1949
1
maj 24
3378
3
lis 23
17576
3
lis 24
25285