Skip to Content
Odoo Menu
  • Log ind
  • Prøv gratis
  • Apps
    Økonomi
    • Bogføring
    • Fakturering
    • Udgifter
    • Regneark (BI)
    • Dokumenter
    • e-Signatur
    Salg
    • CRM
    • Salg
    • POS Butik
    • POS Restaurant
    • Abonnementer
    • Udlejning
    Hjemmeside
    • Hjemmesidebygger
    • e-Handel
    • Blog
    • Forum
    • LiveChat
    • e-Læring
    Forsyningskæde
    • Lagerbeholdning
    • Produktion
    • PLM
    • Indkøb
    • Vedligeholdelse
    • Kvalitet
    HR
    • Medarbejdere
    • Rekruttering
    • Fravær
    • Medarbejdersamtaler
    • Anbefalinger
    • Flåde
    Marketing
    • Markedsføring på sociale medier
    • E-mailmarketing
    • SMS-marketing
    • Arrangementer
    • Automatiseret marketing
    • Spørgeundersøgelser
    Tjenester
    • Projekt
    • Timesedler
    • Udkørende Service
    • Kundeservice
    • Planlægning
    • Aftaler
    Produktivitet
    • Dialog
    • Godkendelser
    • IoT
    • VoIP
    • Vidensdeling
    • WhatsApp
    Tredjepartsapps Odoo Studio Odoo Cloud-platform
  • Brancher
    Detailhandel
    • Boghandel
    • Tøjforretning
    • Møbelforretning
    • Dagligvarebutik
    • Byggemarked
    • Legetøjsforretning
    Mad og værtsskab
    • Bar og pub
    • Restaurant
    • Fastfood
    • Gæstehus
    • Drikkevareforhandler
    • Hotel
    Ejendom
    • Ejendomsmægler
    • Arkitektfirma
    • Byggeri
    • Ejendomsadministration
    • Havearbejde
    • Boligejerforening
    Rådgivning
    • Regnskabsfirma
    • Odoo-partner
    • Marketingbureau
    • Advokatfirma
    • Rekruttering
    • Audit & certificering
    Produktion
    • Tekstil
    • Metal
    • Møbler
    • Fødevareproduktion
    • Bryggeri
    • Firmagave
    Heldbred & Fitness
    • Sportsklub
    • Optiker
    • Fitnesscenter
    • Kosmetolog
    • Apotek
    • Frisør
    Håndværk
    • Handyman
    • IT-hardware og support
    • Solenergisystemer
    • Skomager
    • Rengøringsservicer
    • VVS- og ventilationsservice
    Andet
    • Nonprofitorganisation
    • Miljøagentur
    • Udlejning af billboards
    • Fotografi
    • Cykeludlejning
    • Softwareforhandler
    Gennemse alle brancher
  • Community
    Få mere at vide
    • Tutorials
    • Dokumentation
    • Certificeringer
    • Oplæring
    • Blog
    • Podcast
    Bliv klogere
    • Udannelselsesprogram
    • Scale Up!-virksomhedsspillet
    • Besøg Odoo
    Få softwaren
    • Download
    • Sammenlign versioner
    • Udgaver
    Samarbejde
    • Github
    • Forum
    • Arrangementer
    • Oversættelser
    • Bliv partner
    • Tjenester til partnere
    • Registrér dit regnskabsfirma
    Modtag tjenester
    • Find en partner
    • Find en bogholder
    • Kontakt en rådgiver
    • Implementeringstjenester
    • Kundereferencer
    • Support
    • Opgraderinger
    Github Youtube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Få en demo
  • Prissætning
  • Hjælp

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

  • CRM
  • e-Commerce
  • Bogføring
  • Lager
  • PoS
  • Projekt
  • MRP
All apps
Du skal være registreret for at interagere med fællesskabet.
All Posts People Emblemer
Tags (View all)
odoo accounting v14 pos v15
Om dette forum
Du skal være registreret for at interagere med fællesskabet.
All Posts People Emblemer
Tags (View all)
odoo accounting v14 pos v15
Om dette forum
Hjælp

How do I know which Model(s), method(s) and field(s) to use when I like to send an invoice (by mail) to the invoicee via the external API?

Tilmeld

Få besked, når der er aktivitet på dette indlæg

Dette spørgsmål er blevet anmeldt
apiinvoicing
1 Svar
769 Visninger
Avatar
Mathew Hucks

Dear all, 

I'm trying to send an invoice to the invoicee via the External API. (using this package: Ang3 php-odoo-api-client) 

How can I know which Models / Methods / Fields to use in order to send this mail, with the invoice? 

I'm trying to find out via various ways: checking the External API docs, searching through the Odoo forum, searching online (tutorials, ..). 
The External API docs don't help. 
Couldn't find a relevant / recent Odoo forum post
Online tutorials, via YouTube videos are mostly done by non native-english speaking people so hard to follow. 

I've found several things about using the wizard programmatically in order to send the mail. 
First composing the message (via the wizard?) and then sending it via an additional API call? 

I'd like to find out for versions 17, 18 and 19. 

Looking for a push in the right direction

Thanking you in advance. 


0
Avatar
Kassér
Mathew Hucks
Forfatter

@Ray Carnes: Thank you for your reply.
I'm adding this comment to my post, instead of your answer, because for some reason it's not allowing me to.

I'm trying to check the request-logs via Chrome's developer bar, to see which requests are being done.
That gives me some clarity, but not all the way. For example, I don't see where / how requests are getting their input from. I can guess based on other API requests that are done, but this way of working will cost me hours if not days to completely find out how to do it.

I have an implementation (made in 2022) in our codebase that works for Odoo version 17. I'm not sure if I can keep this for version 18 with some small changes here and there? When I compare what I see in my codebase (for version 17) it does have quite a lot of differences with what I see in the request logs (when connected to a trial (v19) environment).

For what it's worth, here's the (PHP) implementation that I have for v17:

$invoice = $this->accountMoveRepository->find($this->invoice->external_id);
if (! $invoice) {
throw UnableToSendInvoiceException::invoiceDeleted();
}

try {
// Ensure invoice is posted.
$this->accountMoveRepository->update($this->invoice->external_id, ['state' => 'posted']);

$actionSendAndPrint = $this->odoo->api()->call('account.move', 'action_send_and_print', [(int)($this->invoice->external_id)]);
if (empty($actionSendAndPrint['context']['default_template_id'])) {
// This exception is being thrown when connected to Odoo v18
throw UnableToSendInvoiceException::unknownDefaultTemplateId();
}

$response = $this->odoo->api()->call(
'account.invoice.send',
OrmQuery::CREATE,
[
[
'invoice_ids' => [(int)$this->invoice->external_id],
'composition_mode' => 'comment',
'template_id' => $actionSendAndPrint['context']['default_template_id'],
'is_email' => true,
],
],
[
'context' => [
'active_ids' => [(int)$this->invoice->external_id],
'active_id' => (int)$this->invoice->external_id,
'active_model' => 'account.move',
],
]
);

$this->odoo->api()->call(
'account.invoice.send',
'onchange_is_email',
[(int)($response)],
[
'context' => [
'active_ids' => [(int)$this->invoice->external_id],
'active_id' => (int)$this->invoice->external_id,
'active_model' => 'account.move',
],
]
);

$this->odoo->api()->call('account.invoice.send', 'send_and_print_action', [(int)($response)]);
} catch (RemoteException $e) {
throw OdooUserApiException::fromRequestException($e);
}

Avatar
Ray Carnes (ray)
Bedste svar

The easiest and fastest way is to review the Odoo logs (setup to surface the API calls) via either your Odoo.sh staging branch, or your own on premise Odoo installation.

See https://www.odoo.com/forum/help-1/how-can-i-see-which-api-calls-are-made-to-learn-what-odoo-is-doing-at-specific-times-183911

You do what you want to do via code via the UI, and monitor what API calls the web client makes at each step.

0
Avatar
Kassér
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Tilmeld dig
Related Posts Besvarelser Visninger Aktivitet
Convert an order sale to invoice using Odoo 8 API Løst
api invoicing odooV8
Avatar
Avatar
Avatar
2
jan. 19
5088
How do I get Product Prices with json API? Løst
api
Avatar
Avatar
1
nov. 25
3122
Has anyone integrated Helpdesk with Zoom for meeting scheduling?
api
Avatar
Avatar
1
aug. 25
1458
Using API check if Odoo is using Odoo sh or on-premises hosting. Løst
api
Avatar
Avatar
1
aug. 25
1862
External API XMLRPC Authentication Keeps Replying with false
api
Avatar
Avatar
Avatar
2
jul. 25
4820
Community
  • Tutorials
  • Dokumentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Oversættelser
Tjenester
  • Odoo.sh-hosting
  • Support
  • Opgradere
  • Individuelt tilpasset udvikling
  • Uddannelse
  • Find en bogholder
  • Find en partner
  • Bliv partner
Om os
  • Vores virksomhed
  • Brandaktiver
  • Kontakt os
  • Stillinger
  • Arrangementer
  • Podcast
  • Blog
  • Kunder
  • Juridiske dokumenter • Privatlivspolitik
  • Sikkerhedspolitik
الْعَرَبيّة 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 er en samling open source-forretningsapps, der dækker alle dine virksomhedsbehov – lige fra CRM, e-handel og bogføring til lagerstyring, POS, projektledelse og meget mere.

Det unikke ved Odoo er, at systemet både er brugervenligt og fuldt integreret.

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