Hello,
I am trying to build an integration between my PHP website and the Odoo ERP of a customer. This customer is building his website using Odoo v11.
My first issue is that Odoo Web Service API Documentation is not available for v11 ^^ (link returns a 404: https://www.odoo.com/documentation/11.0/api_integration.html).
I am trying to create a "sale.order" object into the Odoo of my customer. My customer told me that I have to:
1) create a sale.order (I provide the partner_id)
2) then call the function "onchange_partner_id" on this sale.order so that it autofills some fields on the sale.order
Step 1) is OK but I cannot find how to do step 2). When I read Odoo Web Service API Documentation v8 (https://www.odoo.com/documentation/8.0/api_integration.html) I see that I can only call the "execute_kw" function and I cannot find how to do use it to call the "onchange_partner_id" function.
For Step 1, I do:
order_id = models.execute_kw(db, uid, password, 'sale.order', 'create', [{
'name': "A new Order", 'partner_id': 17
}])
For Step 2, I tried:
onchange_result = models.execute_kw(db, uid, password, 'sale.order', 'onchange_partner_id', [
order_id
])
or onchange_result = models.execute_kw(db, uid, password, 'sale.order', 'onchange_partner_id', [[
order_id
]])
I get an error message "TypeError: cannot marshal None unless allow_none is enabled"
onchange_result = models.execute_kw(db, uid, password, 'sale.order', 'onchange_partner_id', [[
id: order_id
]])
I get "ERREUR: syntaxe en entrée invalide pour l'entier : id
LINE 1: ... "user_id" FROM "sale_order" WHERE "sale_order".id IN ('id')"
onchange_result = models.execute_kw(db, uid, password, 'sale.order', 'onchange_partner_id', [[
order_id: order_id
]])
I get "TypeError: cannot marshal None unless allow_none is enabled"
Best regards,
Mathieu Ferment
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
1
Trả lời
7612
Lượt xem
Hello Mathieu! I think you just need to instantiate your xmlrpc client like this:
models = xmlrpc.client.ServerProxy('your_url_here', allow_none=True) as for step 2, i think this would work:
onchange_result = models.execute_kw(db, uid, password, 'sale.order', 'onchange_partner_id', [
order_id
])
or
onchange_result = models.execute_kw(db, uid, password, 'sale.order', 'onchange_partner_id', [[
]).
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
1
thg 8 17
|
8816 | ||
|
2
thg 12 23
|
20090 | ||
|
1
thg 8 25
|
354 | ||
|
2
thg 7 25
|
2803 | ||
|
3
thg 7 25
|
618 |