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

I want to sent invoice to the coustomer email using external api

Suscribirse

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

Se marcó esta pregunta
emailexternalapixmlrpc
1 Responder
5064 Vistas
Avatar
ss Sdf

As i am new to the odoo i need some help. i want to sent my created invoice to the coustomer email using external api. here is my code how i am creating the invoice 

import xmlrpc.client

# Odoo API information
url = ''
db = ''
username = ''
password = ''

# Connect to Odoo API
common = xmlrpc.client.ServerProxy('{}/xmlrpc/2/common'.format(url))
uid = common.authenticate(db, username, password, {})

# Create a connection object
models = xmlrpc.client.ServerProxy('{}/xmlrpc/2/object'.format(url))

customer_id=10
product_id
=1
# Create an invoice
invoice_data = {
'partner_id': customer_id, # ID of the customer for whom you want to create the invoice
'move_type': 'out_invoice', # Invoice type (out_invoice for customer invoice)
# Add other invoice data like invoice line items, payment terms, etc.
# For example:
'invoice_line_ids': [
(
0, 0, {
'product_id'
: product_id, # ID of the product on the invoice line
'quantity': 2,
'price_unit': 100.0,
})
]
,
}

invoice_id = models.execute_kw(db, uid, password, 'account.move', 'create', [invoice_data])

# Send the invoice by email
models.execute_kw(db, uid, password, 'account.move', 'action_post', [invoice_id])
invoice_sent = models.execute_kw(db, uid, password, 'account.move', 'action_invoice_sent', [invoice_id])

i am using odoo online. kindly help. 

0
Avatar
Descartar
Avatar
Stanislas Gueniffey (stgu)
Mejor respuesta
import xmlrpc.client

# Odoo API information: edit it to match your config
url = 'http://localhost:8069'
db = 'MY_DB'
username = 'admin'
password = 'admin'

# Connect to Odoo API
# You may support *sending* None values by passing allow_none=True to the ServerProxy
# In order to *receive* None values you would have to modify odoo core (not recommended)
common = xmlrpc.client.ServerProxy('{}/xmlrpc/2/common'.format(url))
uid = common.authenticate(db, username, password, {})

# Create a connection object
models = xmlrpc.client.ServerProxy('{}/xmlrpc/2/object'.format(url))

# Create and post an invoice
invoice_data = {
'partner_id': 10,
'move_type': 'out_invoice',
'invoice_line_ids': [
(0, 0, {
'product_id': 1,
'quantity': 2,
'price_unit': 100.0,
})
],
}
invoice_id_1 = models.execute_kw(db, uid, password, 'account.move', 'create', [invoice_data])
invoice_id_2 = models.execute_kw(db, uid, password, 'account.move', 'create', [invoice_data])
invoice_ids = [invoice_id_1, invoice_id_2]
models.execute_kw(db, uid, password, 'account.move', 'action_post', [invoice_ids])

# Prepare values to create send & print wizard
action_vals = models.execute_kw(db, uid, password, 'account.move', 'action_send_and_print', [invoice_ids])

# arguments
# 1) the ORM create() method needs arguments to complete, since that method starts with
# if not vals_list:
# return self.browse()
# 2) the is_print arg avoids the local printing and downloading of the PDF
# this is simply because account.invoice.send's _print_document() method returns a dict
# containing a None value, which is not supported in xmlrpc unless allow_none is enabled
# 3) the composition_mode is necessary to send multiple e-mails at once
wizard_args = [{'is_print': False, 'composition_mode': 'mass_mail'}]

# keyword arguments: the context contains some necessary values such as active_ids
wizard_kwargs = {'context': action_vals.get('context')}

# Create the wizard
wizard_id = models.execute_kw(db, uid, password, 'account.invoice.send', 'create', wizard_args, wizard_kwargs)

# Use the wizard to send the e-mails
# we provide the context once more as send_and_print_action also relies on it for active_ids
wizard_close = models.execute_kw(db, uid, password, 'account.invoice.send', 'send_and_print_action', [wizard_id], wizard_kwargs)

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
Java xmlrpc not working
external api xmlrpc java
Avatar
Avatar
1
dic 22
3599
Send email for sign request through API
email api xmlrpc typeerror sign
Avatar
Avatar
Avatar
Avatar
3
mar 24
6082
Reset user Password from xmlrpc Odoo 12
external api xmlrpc resetpassword mobileapp
Avatar
Avatar
1
ene 23
3014
XML-RPC API search_read method 100 records' limitation
api xmlrpc
Avatar
Avatar
Avatar
3
ene 23
9391
External API's Resuelto
developement external api xmlrpc v14
Avatar
Avatar
1
jun 22
4516
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.

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