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

Hello, I’m fairly new to using Odoo and I have a question.

I am using the Odoo service to have the server in order to create invoices, and I am currently using it via the API.

My question is about how the body of my request should look in order to generate a link (or something) to download the PDF of an invoice?

I have this: 

Endpoint: [domain].odoo.com/web/dataset/call_kw

Body: 
{

    "jsonrpc": "2.0",

    "method": "call",

    "params": {

        "model": "account.move",

        "method": "print_document",

        "args": [6], 

        "kwargs": {}

    },

    "id": 1

}


Error:  The method 'print_document' does not exist on the model 'account.move'

Thank you very much

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

Hello André, thank you for your response. It turns out that I don’t have Odoo installed on an external server, but on Odoo’s hosting, so I believe I can’t create a new method (or can I?). Could you please give me some guidance on how to grant permissions to my user? I have changed the body of my request, and it shows an error stating that the method I am trying to use is private.

Thank you.

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

Have a look at how to use the API. The documentation helps a little bit.
Pay attention to the version of your Odoo instance.

The most important thing regarding API calls is to understand the Odoo object structure, and how you can call actions, depending on the model, and fields of the record. 

The second part is regarding permissions. 
Your user must have permission to call the objects, or you must set a workaround on the server side,(create a new method or cal)l, that lets you access the information you want to access from the API. 

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 8 25
418
2
thg 7 25
2843
3
thg 7 25
648
1
thg 6 25
2116
1
thg 8 25
1021