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

I'm trying to create an activity for a contact with the Odoo Api.
My Postman test to get or create contacts work fine.
But my jsonRPC to create an activity always throws me the following error:
"'format.address.mixin' object has no attribute 'display_name'"
This is the jsonRPC I'm using. It's mostly like the one I use for create and get contacts.
Somebody an idea what could be wrong?
{

  "jsonrpc": "2.0",

  "method": "call",

  "params": {

    "service": "object",

    "method": "execute_kw",

    "args": [

      „<dbname>“,

      2,

      „<apikey>",

      "mail.activity",

      "create",

      [

        {

          "res_id": <contactid>,             

          "res_model_id": 85,       

          "activity_type_id": 2,     

          "summary": „<text>",

          "note": „<text>“

        }

      ]

    ]

  },

  "id": 1

}

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

Thanks. But it doesn't work.

The operation cannot be completed:\n- Create/update: a mandatory field is not set.\n- Delete: another model requires the record being deleted. If possible, archive it instead.\n\nModel: Activity (mail.activity)\nField: Document Model (res_model_id)\n

I tried to add the missing field but that just brings me back the display_name error.
Even copilot and chatGpt recomment mine or your solution but it doesn't work.
I wonder if this is a bug in the Odoo api.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Try this

{

  "jsonrpc": "2.0",

  "method": "call",

  "params": {

    "service": "object",

    "method": "execute_kw",

    "args": [

      "<dbname>",

      2,

      "<apikey>",

      "mail.activity",

      "create",

      [

        {

          "res_id": <contactid>,           

          "res_model": "res.partner", 

          "activity_type_id": 2, 

          "summary": "<text>",

          "note": "<text>"

        }

      ]

    ]

  },

  "id": 1

}


อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ม.ค. 25
1445
Postman Api แก้ไขแล้ว
2
พ.ย. 22
8874
0
ก.ค. 21
3715
Using paramiko and odoo 9 แก้ไขแล้ว
1
ธ.ค. 15
5959
0
ก.ย. 24
1010