Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
2 Replies
3887 Tampilan

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
Buang

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

Jawaban Terbai

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
Buang
Jawaban Terbai

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
Buang
Post Terkait Replies Tampilan Aktivitas
2
Jul 19
4130
0
Mei 19
4196
1
Apr 19
2025
1
Jun 17
3626
1
Mar 15
6265