Skip to Content
Odoo Menu
  • Prisijungti
  • Išbandykite nemokamai
  • Programėlės
    Finansai
    • Apskaita
    • Pateikimas apmokėjimui
    • Sąnaudos
    • Skaičiuoklė (BI)
    • Dokumentai
    • Pasirašymas
    Pardavimai
    • CRM
    • Pardavimai
    • Kasų sistema - Parduotuvė
    • Kasų sistema - Restoranas
    • Prenumeratos
    • Nuoma
    Svetainės
    • Svetainių kūrėjimo įrankis
    • El. Prekyba
    • Internetinis Tinklaraštis
    • Forumas
    • Tiesioginis pokalbis
    • eMokymasis
    Tiekimo grandinė
    • Atsarga
    • Gamyba
    • PLM
    • Įsigijimai
    • Priežiūra
    • Kokybė
    Žmogaus ištekliai
    • Darbuotojai
    • Įdarbinimas
    • Atostogos
    • Įvertinimai
    • Rekomendacijos
    • Transporto priemonės
    Rinkodara
    • Socialinė rinkodara
    • Rinkodara el. paštu
    • SMS rinkodara
    • Renginiai
    • Rinkodaros automatizavimas
    • Apklausos
    Paslaugos
    • Projektas
    • Darbo laiko žiniaraščiai
    • Priežiūros tarnyba
    • Pagalbos tarnyba
    • Planavimas
    • Rezervacijos
    Produktyvumas
    • Diskucija
    • Patvirtinimai
    • IoT
    • VoIP
    • Žinių biblioteka
    • WhatsApp
    Trečiųjų šalių programos Odoo Studija Odoo debesijos platforma
  • Pramonės šakos
    Mažmeninė prekyba
    • Knygynas
    • Drabužių parduotuvė
    • Baldų parduotuvė
    • Maisto prekių parduotuvė
    • Techninės įrangos parduotuvė
    • Žaislų parduotuvė
    Food & Hospitality
    • Barai ir pub'ai
    • Restoranas
    • Greitasis maistas
    • Guest House
    • Gėrimų platintojas
    • Hotel
    Nekilnojamasis turtas
    • Real Estate Agency
    • Architektūros įmonė
    • Konstrukcija
    • Estate Managament
    • Sodininkauti
    • Turto savininkų asociacija
    Konsultavimas
    • Accounting Firm
    • Odoo Partneris
    • Marketing Agency
    • Teisinė firma
    • Talentų paieška
    • Auditai & sertifikavimas
    Gamyba
    • Textile
    • Metal
    • Furnitures
    • Maistas
    • Brewery
    • Įmonių dovanos
    Sveikata & Fitnesas
    • Sporto klubas
    • Akinių parduotuvė
    • Fitneso Centras
    • Sveikatos praktikai
    • Vaistinė
    • Kirpėjas
    Trades
    • Handyman
    • IT įranga ir palaikymas
    • Saulės energijos sistemos
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Kiti
    • Nonprofit Organization
    • Aplinkos agentūra
    • Reklaminių stendų nuoma
    • Fotografavimas
    • Dviračių nuoma
    • Programinės įrangos perpardavėjas
    Browse all Industries
  • Bendrija
    Mokykitės
    • Mokomosios medžiagos
    • Dokumentacija
    • Sertifikatai
    • Mokymai
    • Internetinis Tinklaraštis
    • Tinklalaidės
    Skatinkite švietinimą
    • Švietimo programa
    • Scale Up! Verslo žaidimas
    • Aplankykite Odoo
    Gaukite programinę įrangą
    • Atsisiųsti
    • Palyginkite versijas
    • Leidimai
    Bendradarbiauti
    • Github
    • Forumas
    • Renginiai
    • Vertimai
    • Tapkite partneriu
    • Services for Partners
    • Registruokite jūsų apskaitos įmonę
    Gaukite paslaugas
    • Susiraskite partnerį
    • Susirask buhalterį
    • Susitikti su konsultantu
    • Diegimo paslaugos
    • Klientų rekomendavimas
    • Palaikymas
    • Atnaujinimai
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Gaukite demo
  • Kainodara
  • Pagalba

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

  • CRM
  • e-Commerce
  • Apskaita
  • Atsarga
  • PoS
  • Projektas
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
Pagalba

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?

Prenumeruoti

Get notified when there's activity on this post

This question has been flagged
apiinvoicing
1 Atsakyti
770 Rodiniai
Portretas
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
Portretas
Atmesti
Mathew Hucks
Autorius

@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);
}

Portretas
Ray Carnes (ray)
Best Answer

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
Portretas
Atmesti
Enjoying the discussion? Don't just read, join in!

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

Registracija
Related Posts Replies Rodiniai Veikla
Convert an order sale to invoice using Odoo 8 API Solved
api invoicing odooV8
Portretas
Portretas
Portretas
2
saus. 19
5089
How do I get Product Prices with json API? Solved
api
Portretas
Portretas
1
lapkr. 25
3124
Has anyone integrated Helpdesk with Zoom for meeting scheduling?
api
Portretas
Portretas
1
rugp. 25
1458
Using API check if Odoo is using Odoo sh or on-premises hosting. Solved
api
Portretas
Portretas
1
rugp. 25
1863
External API XMLRPC Authentication Keeps Replying with false
api
Portretas
Portretas
Portretas
2
liep. 25
4821
Bendrija
  • Mokomosios medžiagos
  • Dokumentacija
  • Forumas
Atvirasis kodas
  • Atsisiųsti
  • Github
  • Runbot
  • Vertimai
Paslaugos
  • Odoo.sh talpinimas
  • Palaikymas
  • Atnaujinti
  • Pritaikytas programavimo kūrimas
  • Švietimas
  • Susirask buhalterį
  • Susiraskite partnerį
  • Tapkite partneriu
Apie mus
  • Mūsų įmonė
  • Prekės ženklo turtas
  • Susisiekite su mumis
  • Darbo pasiūlymai
  • Renginiai
  • Tinklalaidės
  • Internetinis Tinklaraštis
  • Klientai
  • Teisinis • Privatumas
  • Saugumas
الْعَرَبيّة 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 yra atvirojo kodo verslo programų rinkinys, kuris apima visas įmonės poreikius: CRM, El. Prekybą, Apskaitą, Atsargų, Kasų sistemą, Projektų valdymą ir kt.

Unikali Odoo vertės pasiūla – būti tuo pačiu metu labai lengvai naudojama ir visiškai integruota sistema.

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