コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
5726 ビュー

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'

          

        })


アバター
破棄
関連投稿 返信 ビュー 活動
4
12月 24
18288
1
1月 23
1952
1
5月 24
3386
3
11月 23
17596
3
11月 24
25302