Ir al contenido
Odoo Menú
  • Iniciar sesión
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • PdV para tiendas
    • PdV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en vivo
    • eLearning
    Cadena de suministro
    • Inventario
    • Manufactura
    • PLM
    • Compras
    • Mantenimiento
    • Calidad
    Recursos humanos
    • Empleados
    • Reclutamiento
    • Vacaciones
    • Evaluaciones
    • Referencias
    • Flotilla
    Marketing
    • Redes sociales
    • Marketing por correo
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyectos
    • Registro de horas
    • Servicio externo
    • Soporte al cliente
    • Planeación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Artículos
    • WhatsApp
    Aplicaciones externas Studio de Odoo Plataforma de Odoo en la nube
  • Industrias
    Venta minorista
    • Librería
    • Tienda de ropa
    • Mueblería
    • Tienda de abarrotes
    • Ferretería
    • Juguetería
    Alimentos y hospitalidad
    • Bar y pub
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidora de bebidas
    • Hotel
    Bienes inmuebles
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión de bienes inmuebles
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Firma contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Manufactura
    • Textil
    • Metal
    • Muebles
    • Comida
    • Cervecería
    • Regalos corporativos
    Salud y ejercicio
    • Club deportivo
    • Óptica
    • Gimnasio
    • Especialistas en bienestar
    • Farmacia
    • Peluquería
    Trades
    • Personal de mantenimiento
    • Hardware y soporte de TI
    • Sistemas de energía solar
    • Zapateros y fabricantes de calzado
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin fines de lucro
    • Agencia para la protección del medio ambiente
    • Alquiler de anuncios publicitarios
    • Fotografía
    • Alquiler de bicicletas
    • Distribuidor de software
    Descubre todas las industrias
  • Odoo Community
    Aprende
    • Tutoriales
    • Documentación
    • Certificaciones
    • Capacitación
    • Blog
    • Podcast
    Fortalece la educación
    • Programa educativo
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtén el software
    • Descargar
    • Compara ediciones
    • Versiones
    Colabora
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Conviértete en partner
    • Servicios para partners
    • Registra tu firma contable
    Obtén servicios
    • Encuentra un partner
    • Encuentra un contador
    • Contacta a un consultor
    • Servicios de implementación
    • Referencias de clientes
    • Soporte
    • Actualizaciones
    GitHub YouTube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicita una demostración
  • Precios
  • Ayuda

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

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyectos
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

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?

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
apiinvoicing
1 Responder
760 Vistas
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
Descartar
Mathew Hucks
Autor

@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)
Mejor respuesta

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
Descartar
¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Registrarse
Publicaciones relacionadas Respuestas Vistas Actividad
Convert an order sale to invoice using Odoo 8 API Resuelto
api invoicing odooV8
Avatar
Avatar
Avatar
2
ene 19
5081
How do I get Product Prices with json API? Resuelto
api
Avatar
Avatar
1
nov 25
3071
Has anyone integrated Helpdesk with Zoom for meeting scheduling?
api
Avatar
Avatar
1
ago 25
1456
Using API check if Odoo is using Odoo sh or on-premises hosting. Resuelto
api
Avatar
Avatar
1
ago 25
1852
External API XMLRPC Authentication Keeps Replying with false
api
Avatar
Avatar
Avatar
2
jul 25
4801
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento en Odoo.sh
  • Soporte
  • Actualizaciones del software
  • Desarrollos personalizados
  • Educación
  • Encuentra un contador
  • Encuentra un partner
  • Conviértete en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contáctanos
  • Empleos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Legal • Privacidad
  • Seguridad
الْعَرَبيّة 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 es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y estar totalmente integrado.

Sitio web hecho con

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