Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
240 Lượt xem

I have 2 instances of odoo with me. One is paid version and the other is free one.

I want to fetch roles which can be assigned to user in a specific application via APIs. I am using following API in Postman mentioned below:

curl --location 'domain/jsonrpc' \

--header 'Content-Type: application/json' \

--data '{

    "jsonrpc": "2.0",

    "method": "call",

    "params": {

      "service": "object",

      "method": "execute_kw",

      "args": [

        "domain",          

        adminid,                   

        "api-key",      

        "res.groups",        

        "search_read",       

        [[["category_id.name", "=", "Sales"]]],  

        {

          "fields": ["id", "name", "category_id", "comment"]

        }

      ]

    },

    "id": 50

  }'

When I was using this API on the paid instance of Odoo, I was able to fetch the roles according to the category correctly as was expected by me:
{

    "jsonrpc": "2.0",

    "id": 50,

    "result": [

        {

            "id": 22,

            "name": "User: Own Documents Only",

            "category_id": [

                19,

                "Sales"

            ],

            "comment": "the user will have access to his own data in the sales application."

        },

        {

            "id": 23,

            "name": "User: All Documents",

            "category_id": [

                19,

                "Sales"

            ],

            "comment": "the user will have access to all records of everyone in the sales application."

        },

        {

            "id": 24,

            "name": "Administrator",

            "category_id": [

                19,

                "Sales"

            ],

            "comment": "the user will have an access to the sales configuration as well as statistic reports."

        }

    ]



But now I had to switch to the free instance and the API isn't working as expected.
Getting the following error:

"message": "Invalid field res.groups.category_id in condition ('category_id.name', '=', 'Sales')",

Is this because of a licensing issue?

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

hello, i'm sure its not because of licensing Issue. Have you tried fetching records from odoo using odoo's XML-RPC connection? you might want to see this as a reference : https://github.com/altela/odoo-api

Hope this helps,

Altela (altelasoftware.com)

Ảnh đại diện
Huỷ bỏ