Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
3895 Widoki

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

Awatar
Odrzuć

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

Najlepsza odpowiedź

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)
Awatar
Odrzuć
Najlepsza odpowiedź

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).

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
2
lip 19
4144
0
maj 19
4202
1
kwi 19
2025
1
cze 17
3646
1
mar 15
6269