Zum Inhalt springen
Odoo Menü
  • Anmelden
  • Jetzt gratis testen
  • Apps
    Finanzen
    • Buchhaltung
    • Rechnungsstellung
    • Spesenabrechnung
    • Tabellenkalkulation (BI)
    • Dokumente
    • E-Signatur
    Vertrieb
    • CRM
    • Vertrieb
    • Kassensystem – Shop
    • Kassensystem – Restaurant
    • Abonnements
    • Vermietung
    Websites
    • Website-Builder
    • E-Commerce
    • Blog
    • Forum
    • Livechat
    • E-Learning
    Lieferkette
    • Lager
    • Fertigung
    • PLM
    • Einkauf
    • Wartung
    • Qualität
    Personalwesen
    • Mitarbeiter
    • Personalbeschaffung
    • Abwesenheiten
    • Mitarbeiterbeurteilung
    • Personalempfehlungen
    • Fuhrpark
    Marketing
    • Social Marketing
    • E-Mail-Marketing
    • SMS-Marketing
    • Veranstaltungen
    • Marketing-Automatisierung
    • Umfragen
    Dienstleistungen
    • Projekte
    • Zeiterfassung
    • Außendienst
    • Kundendienst
    • Planung
    • Termine
    Produktivität
    • Dialog
    • Genehmigungen
    • IoT
    • VoIP
    • Wissensdatenbank
    • WhatsApp
    Apps von Drittanbietern Odoo Studio Odoo Cloud-Plattform
  • Branchen
    Einzelhandel
    • Buchladen
    • Kleidergeschäft
    • Möbelhaus
    • Lebensmittelgeschäft
    • Baumarkt
    • Spielwarengeschäft
    Essen & Gastgewerbe
    • Bar und Kneipe
    • Restaurant
    • Fast Food
    • Gästehaus
    • Getränkehändler
    • Hotel
    Immobilien
    • Immobilienagentur
    • Architekturbüro
    • Baugewerbe
    • Immobilienverwaltung
    • Gartenarbeit
    • Eigentümervereinigung
    Beratung
    • Buchhaltungsfirma
    • Odoo-Partner
    • Marketingagentur
    • Anwaltskanzlei
    • Talentakquise
    • Prüfung & Zertifizierung
    Fertigung
    • Textil
    • Metall
    • Möbel
    • Speisen
    • Brauerei
    • Firmengeschenke
    Gesundheit & Fitness
    • Sportklub
    • Brillengeschäft
    • Fitnessstudio
    • Therapeut
    • Apotheke
    • Friseursalon
    Handel
    • Handyman
    • IT-Hardware & -Support
    • Solarenergiesysteme
    • Schuster
    • Reinigungsdienstleistungen
    • HLK-Dienstleistungen
    Sonstiges
    • Gemeinnützige Organisation
    • Umweltschutzagentur
    • Plakatwandvermietung
    • Fotostudio
    • Fahrrad-Leasing
    • Software-Händler
    Alle Branchen ansehen
  • Community
    Lernen
    • Tutorials
    • Dokumentation
    • Zertifizierungen
    • Schulung
    • Blog
    • Podcast
    Bildung fördern
    • Bildungsprogramm
    • Scale-Up! Planspiel
    • Odoo besuchen
    Software anfragen
    • Herunterladen
    • Editionen vergleichen
    • Releases
    Zusammenarbeiten
    • Github
    • Forum
    • Veranstaltungen
    • Übersetzungen
    • Partner werden
    • Dienstleistungen für Partner
    • Buchhaltungsfirma registrieren
    Services anfragen
    • Partner finden
    • Buchhalter finden
    • Einen Experten treffen
    • Implementierungsservices
    • Kundenreferenzen
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Eine Demo erhalten
  • Preiskalkulation
  • Hilfe

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Buchhaltung
  • Lager
  • PoS
  • Projekte
  • MRP
All apps
Sie müssen registriert sein, um mit der Community zu interagieren.
Alle Beiträge Personen Abzeichen
Stichwörter (Alle anzeigen)
odoo accounting v14 pos v15
Über dieses Forum
Sie müssen registriert sein, um mit der Community zu interagieren.
Alle Beiträge Personen Abzeichen
Stichwörter (Alle anzeigen)
odoo accounting v14 pos v15
Über dieses Forum
Hilfe

Trying to Create Invoices via API

Abonnieren

Erhalten Sie eine Benachrichtigung, wenn es eine Aktivität zu diesem Beitrag gibt

Diese Frage wurde gekennzeichnet
accountingapiAPI
2 Antworten
5129 Ansichten
Avatar
Dan Cliff

I'm writing a solution for managing my etsy store and am using Odoo online. I can successfully create an invoice via the API using my Make.com instance, however when I try to add the line items to the invoice, I get the error 1 , shown at the bottom of this post.


I'm sure it's a syntax issue, but I'm strugging to figure out what's wrong with it.

My research suggests the issue is the curly braces inside the invoice_line_ids array, however when I remove them, I end up with Error 2.


I'm using Odoo Online with Stuido, so custom code isn't possible.


Is this a language compatibility issue, because I've witten the API call in json?


Invoice Model: account.move

My code.

[
    {
        "partner_id": 14,
        "move_type": "out_invoice",
        "invoice_date": "{{now}}",
        "invoice_date_due": "{{now}}",
        "invoice_payment_term_id": 1,
        "journal_id": 8,
        "currency_id": 173,
        "invoice_line_ids": [{
                "product_id": 9056,
                "name": "Font: Julzy",
                "quantity": 1,
                "product_uom_id": 30,
                "price_unit": 10.00,
                "discount": 0,
                "account_id": 175,
                "tax_ids": [39]
        }]
    }
]


Error 1:

RuntimeError

[1] Traceback (most recent call last): File "/home/odoo/src/odoo/18.0/odoo/addons/base/controllers/rpc.py", line 165, in xmlrpc_2 response = self._xmlrpc(service) ^^^^^^^^^^^^^^^^^^^^^ File "/home/odoo/src/custom/trial/saas_trial/controllers/main.py", line 306, in _xmlrpc res = super(OdooRPC, self)._xmlrpc(service) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/odoo/src/odoo/18.0/odoo/addons/base/controllers/rpc.py", line 139, in _xmlrpc result = dispatch_rpc(service, method, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/odoo/src/odoo/18.0/odoo/http.py", line 398, in dispatch_rpc return dispatch(method, params) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/odoo/src/odoo/18.0/odoo/service/model.py", line 58, in dispatch res = execute_kw(db, uid, *params[3:]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/odoo/src/odoo/18.0/odoo/service/model.py", line 81, in execute_kw return execute(db, uid, obj, method, *args, **kw or {}) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/odoo/src/odoo/18.0/odoo/service/model.py", line 87, in execute res = execute_cr(cr, uid, obj, method, *args, **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/odoo/src/odoo/18.0/odoo/service/model.py", line 72, in execute_cr result = retrying(partial(odoo.api.call_kw, recs, method, args, kw), env) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/odoo/src/odoo/18.0/odoo/service/model.py", line 156, in retrying result = func() ^^^^^^ File "/home/odoo/src/odoo/18.0/odoo/api.py", line 533, in call_kw result = getattr(recs, name)(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<decorator-gen-214>", line 2, in create File "/home/odoo/src/odoo/18.0/odoo/api.py", line 495, in _model_create_multi return create(self, [arg]) ^^^^^^^^^^^^^^^^^^^ File "/home/odoo/src/odoo/18.0/addons/purchase/models/account_invoice.py", line 167, in create moves = super(AccountMove, self).create(vals_list) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<decorator-gen-70>", line 2, in create File "/home/odoo/src/odoo/18.0/odoo/api.py", line 496, in _model_create_multi return create(self, arg) ^^^^^^^^^^^^^^^^^ File "/home/odoo/src/odoo/18.0/addons/account/models/account_move.py", line 3189, in create moves = super().create(vals_list) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "<decorator-gen-41>", line 2, in create File "/home/odoo/src/odoo/18.0/odoo/api.py", line 496, in _model_create_multi return create(self, arg) ^^^^^^^^^^^^^^^^^ File "/home/odoo/src/odoo/18.0/addons/mail/models/mail_thread.py", line 268, in create threads = super(MailThread, self).create(vals_list) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<decorator-gen-0>", line 2, in create File "/home/odoo/src/odoo/18.0/odoo/api.py", line 496, in _model_create_multi return create(self, arg) ^^^^^^^^^^^^^^^^^ File "/home/odoo/src/odoo/18.0/odoo/models.py", line 5020, in create records = self._create(data_list) ^^^^^^^^^^^^^^^^^^^^^^^ File "/home/odoo/src/odoo/18.0/odoo/models.py", line 5263, in _create field.create([ File "/home/odoo/src/odoo/18.0/odoo/fields.py", line 4503, in create self.write_batch(record_values, True) File "/home/odoo/src/odoo/18.0/odoo/fields.py", line 4529, in write_batch self.write_real(records_commands_list, create) File "/home/odoo/src/odoo/18.0/odoo/fields.py", line 4714, in write_real to_link[recs[-1]].update(line_ids) File "/home/odoo/src/odoo/18.0/odoo/tools/misc.py", line 1076, in update self._map.update(zip(elems, itertools.repeat(None))) TypeError: unhashable type: 'dict'


Error 2

IMLError

Function 'createRequestBody' finished with error! Expected ',' or ']' after array element in JSON at position 312


​
0
Avatar
Verwerfen
Avatar
Yvan Zaugg
Beste Antwort

Hi Dan

for One2many and Many2many fields, you need to pass a tuple with 3 elements (see https://www.odoo.com/documentation/18.0/developer/reference/backend/orm.html#odoo.fields.Command).

You must use this format for the invoice_line_ids and tax_ids attribute.
In your case, the first element will have the value 0 (create a new record), the second value 0 (no related record) and the third the dictionary you have defined.

[
    {
        "partner_id": 14,
        "move_type": "out_invoice",
        "invoice_date": "{{now}}",
        "invoice_date_due": "{{now}}",
        "invoice_payment_term_id": 1,
        "journal_id": 8,
        "currency_id": 173,
        "invoice_line_ids": [(0, 0, {
                "product_id": 9056,
                "name": "Font: Julzy",
                "quantity": 1,
                "product_uom_id": 30,
                "price_unit": 10.00,
                "discount": 0,
                "account_id": 175,
                "tax_ids": [(0, 0, 39)]
        })]
    }
]

I hope it will work. Good luck


Best regards
Yvan

1
Avatar
Verwerfen
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Beste Antwort

Hi,

Please refer to the code below:



[

    {

        "partner_id": 14,

        "move_type": "out_invoice",

        "invoice_date": "2024-02-15",

        "invoice_date_due": "2024-02-15",

        "invoice_payment_term_id": 1,

        "journal_id": 8,

        "currency_id": 173,

        "invoice_line_ids": [

            [0, 0, {

                "product_id": 9056,

                "name": "Font: Julzy",

                "quantity": 1,

                "product_uom_id": 30,

                "price_unit": 10.00,

                "discount": 0,

                "account_id": 175,

                "tax_ids": [[0, 0, 39]]

            }]

        ]

    }

]


Hope it helps.

1
Avatar
Verwerfen
Diskutieren Sie gerne? Treten Sie bei, statt nur zu lesen!

Erstellen Sie heute ein Konto, um exklusive Funktionen zu nutzen und mit unserer tollen Community zu interagieren!

Registrieren
Verknüpfte Beiträge Antworten Ansichten Aktivität
Creating multiple records in one API call.
api API
Avatar
0
Okt. 24
2158
How to generate accounting report via xmlrpc call odoo 17
accounting api Odoo17
Avatar
Avatar
1
Juli 25
2512
Is there a connector available for Odoo V8 to Exact Online Accounting?
accounting api odooV8
Avatar
Avatar
1
Dez. 17
4434
check_total and _default_unit_price missing link
purchase accounting api
Avatar
0
März 15
4369
compute_taxes with XML RPC
accounting api webservices rpc
Avatar
Avatar
2
Mai 24
4733
Community
  • Tutorials
  • Dokumentation
  • Forum
Open Source
  • Herunterladen
  • Github
  • Runbot
  • Übersetzungen
Dienstleistungen
  • Odoo.sh-Hosting
  • Support
  • Upgrade
  • Individuelle Entwicklungen
  • Bildung
  • Buchhalter finden
  • Partner finden
  • Partner werden
Über uns
  • Unsere Firma
  • Markenwerte
  • Kontakt
  • Karriere
  • Veranstaltungen
  • Podcast
  • Blog
  • Kunden
  • Rechtliches • Datenschutz
  • Sicherheit
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo ist eine Suite von Open-Source-Betriebsanwendungen, die alle Bedürfnisse Ihres Unternehmens abdecken: CRM, E-Commerce, Buchhaltung, Lager, Kassensystem, Projektmanagement etc.

Das einzigartige Wertversprechen von Odoo ist, dass es gleichzeitig sehr einfach zu bedienen und voll integriert ist.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now