Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
3849 Vistas

Hello,


I manage to create customers and invoices and link them through the API. But I have a problem when trying to import invoices from the ODOO interface.

The error is that the external id corresponding to the partner_id / id I provide does not match any records.

What should I do so that the clients created through the API are found in this list? and is it possible to configure this id when creating the client via the API?


Thank you

Avatar
Descartar

If the partner is already registered, then fetch the related partner and assign in invoice. Both creation and fetching partners are possible with ODOO web services/API

Mejor respuesta

If you are creating a Customer / Vendor using something like this:

new_customer_vals = {
'name': customer_name,
'company_type': 'company',
...
}
new_partner_id = sock.execute(dbname, uid, pwd, 'res.partner', 'create', new_customer_vals)

Then you can create the External ID immediately after you create the Partner record using something like this:

new_external_id_vals = {
'model': 'res.partner',
'module': 'api_generated',
'name': unique_customer_ref,
'res_id': new_partner_id,
}
it_worked = sock.execute(dbname, uid, pwd, 'ir.model.data', 'create', new_external_id_vals)
Avatar
Descartar
Mejor respuesta

When you create invoices using a partner external_id that external_id needs to be created.

When you import something you can provide Odoo with and external_id or Odoo can generate it for you. External ID is a reference that you and Odoo agree to used to reference an object. Odoo external id's used for import are ephemeral but they allow you to name your imported partner so that you refer them next time you import. Other option is to use the Database ID which is the existing id of the partner on the Odoo database (once created never changes).

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
2
jul 19
4056
0
may 19
4125
1
abr 19
2025
1
jun 17
3557
1
mar 15
6179