Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1067 มุมมอง

Hi everyone,

I would like to add a new tab in res.partner form with data retrieved from an external API. So I created a custom addon where I created a view that inherited view_partner_form. 

Then I got my model :


from odoo import models
import json
import random
import urllib.request
class Facturation(models.Model):
_inherit = 'res.partner'
def json_rpc(self):
req = urllib.request.Request(url='myurl',headers={"Content-Type":"application/json"})
reply = json.loads(urllib.request.urlopen(req).read().decode('UTF-8'))
if reply.get("error"):
raise Exception(reply["error"])  
return {
'key1': reply['value1'],
'key2': reply['value2']
}


Everything works fine but now I would like to know how to display my dictionnary and loop through it in my arch view inside the xpath of my view ?

Thanks a lot

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
เม.ย. 24
1276
2
มี.ค. 15
8769
1
ส.ค. 25
441
2
ก.ค. 25
2872
API xmlrpc - upload pdf bills to account แก้ไขแล้ว
3
ก.ค. 25
663