跳至内容
菜单
此问题已终结
1 回复
5713 查看

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
18271
1
1月 23
1949
1
5月 24
3378
3
11月 23
17576
3
11月 24
25285