Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
1811 Vistas

Buenas para todos.

Estoy intentando crear facturas desde un sistema externo, por lo que antes de adentrarme en el desarrollo he decidio documentar en Postman todos los endpoints que debo utilizar de odoo. 

Ya puedo buscar clientes, crear clientes, buscar articulos y crear articulos. 
Lo que no estoy pudiendo es crear la factura, pues no encuentro documentación para la misma.

Si bien mirando el modelo de datos me aproximo a algo, pues siempre un nuevo error salta. Alguien tiene mas información sobre como se crea el json a enviar via API RPC para la creación de facturas?

Dejo por aquí lo que he podido ir armando.

{ ​"jsonrpc": "2.0",

​"method": "call",

​"params": {

​"context": { "uid": 10, "lang": "es_UY" },

​ "model": "account.invoice",

​"method": "create",

​"args": [{

​"partner_id": 1423, // ID del cliente

​"invoice_line_ids": [ [0, 0, {

​"product_id": 112, // ID del producto ​"quantity": 2,

​"name":"prueba json rpc",

​ "price_unit": 50.0 }],

​[0, 0, { "product_id": 113, // ID del segundo producto

​"quantity": 3,

​"name" : "PRUEBA JSON RPC",

​"price_unit": 60.0 }] ] }], //

​"invoice_origin": "Pedido de venta 123", // Nro de pedido de venta

​"invoice_payment_term_id": 1, // Términos de pago

​​ "account_analytic_id": 5, // ID de la cuenta analítica

​"sent": true, "kwargs" : {}
​}

}

Avatar
Descartar
Autor Mejor respuesta

English there:

Hello everyone,

I'm trying to create invoices from an external system, so before diving into development, I've decided to document all the endpoints I need to use in Odoo using Postman.

I can already search for customers, create customers, search for products, and create products. However, I'm having trouble creating invoices because I can't find documentation for it.

While looking at the data model gives me some insight, I always encounter a new error. Does anyone have more information on how to create the JSON to be sent via the RPC API for invoice creation?

Here's what I've been able to put together:

[

Avatar
Descartar
Autor

I can made a draft invoice :

URL: https://localhost:8069//web/dataset/call_kw/sale.advance.payment.inv/create

JSON:

{
"jsonrpc":"2.0",
"method":"call",
"params":
{"args":[{
"type":"out_invoice",
"move_name":false,
"user_id":6,
"team_id":1,
"currency_id":2,
"comment":"Factura web",
"journal_id":1,
"company_id":1,
"incoterm_id":false,
"sequence_number_next":false,
"partner_id":1423,
"partner_shipping_id":1423,
"payment_term_id":1,
"cash_rounding_id":false,
"date_invoice":"2023-10-17",
"date_due":"2023-10-17",
"x_contado_credito":"contado",
"x_referencia_manual":false,
"invoice_line_ids":[ //son las lineas de la factura
[0,"virtual_2321",{"sequence":10,"display_type":false,"account_id":111,"quantity":1,"discount":0,"product_id":112,"origin":false,"is_rounding_line":false,"name":"","account_analytic_id":4,"analytic_tag_ids":[[6,false,[]]],"uom_id":1,"price_unit":200,"invoice_line_tax_ids":[[6,false,[3]]],"currency_id":2}]
],
"account_id":6,
"reference":false,
"name":false,
"fiscal_position_id":false,
"origin":false,
"incoterms_id":false,
"partner_bank_id":false,
"tax_line_ids":[
[0,"virtual_2365",{
"analytic_tag_ids":[[6,false,[]]],
"name":"Ventas Exentos IVA",
"tax_id":3,
"account_id":111,
"account_analytic_id":4,
"amount":0,
"amount_rounding":0,
"manual":false,
"sequence":1,
"currency_id":2}]
],
"x_lugar_entrega_mercaderia":false,
"x_referencia_ocompra":false,
"x_rep_impresa_fact":false,
"x_referencia_global":false,
"message_attachment_count":0}
],
"model":"account.invoice",
"method":"create",
"kwargs":{
"context":{"lang":"es_UY","tz":"America/Montevideo","uid":6,"type":"out_invoice","journal_type":"sale"}
}
}
//"id":740910454
}

{
"jsonrpc":"2.0",
"method":"call",
"params":
{"args":[{
"type":"out_invoice",
"move_name":false,
"user_id":6,
"team_id":1,
"currency_id":2,
"comment":"Factura web",
"journal_id":1,
"company_id":1,
"incoterm_id":false,
"sequence_number_next":false,
"partner_id":1423,
"partner_shipping_id":1423,
"payment_term_id":1,
"cash_rounding_id":false,
"date_invoice":"2023-10-17",
"date_due":"2023-10-17",
"x_contado_credito":"contado",
"x_referencia_manual":false,
"invoice_line_ids":[ //son las lineas de la factura
[0,"virtual_2321",{"sequence":10,"display_type":false,"account_id":111,"quantity":1,"discount":0,"product_id":112,"origin":false,"is_rounding_line":false,"name":"","account_analytic_id":4,"analytic_tag_ids":[[6,false,[]]],"uom_id":1,"price_unit":200,"invoice_line_tax_ids":[[6,false,[3]]],"currency_id":2}]
],
"account_id":6,
"reference":false,
"name":false,
"fiscal_position_id":false,
"origin":false,
"incoterms_id":false,
"partner_bank_id":false,
"tax_line_ids":[
[0,"virtual_2365",{
"analytic_tag_ids":[[6,false,[]]],
"name":"Ventas Exentos IVA",
"tax_id":3,
"account_id":111,
"account_analytic_id":4,
"amount":0,
"amount_rounding":0,
"manual":false,
"sequence":1,
"currency_id":2}]
],
"x_lugar_entrega_mercaderia":false,
"x_referencia_ocompra":false,
"x_rep_impresa_fact":false,
"x_referencia_global":false,
"message_attachment_count":0}
],
"model":"account.invoice",
"method":"create",
"kwargs":{
"context":{"lang":"es_UY","tz":"America/Montevideo","uid":6,"type":"out_invoice","journal_type":"sale"}
}
}
//"id":740910454
}

Publicaciones relacionadas Respuestas Vistas Actividad
0
feb 25
1797
0
oct 20
4867
0
feb 24
3859
1
abr 25
1031
2
ago 24
36