hello,
I want to write data from API call into res.partner models.
Here's my function:
class ResPartners(models.Model):
_inherit = 'res.partner'
def get_customer(self):
url = "http://102.216.88.33/api/2.0/admin/customers/customer"
payload = {}
headers = {
'Authorization': '{{authorizationHeader}}'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
data =response.json()
# print(data,"dataaaaaaa")
x= self.env['res.partner'].sudo().create({'id':data['partner_id'],'email':data['email'],'name':data['name'],'phone':data['phone']})
print(x)
and I created scheduled action to call the function, but I get keyerror['partner_id']
Thank you in advance for any help.