Ir al contenido
Odoo Menú
  • Identificarse
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • TPV para tiendas
    • TPV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en directo
    • eLearning
    Cadena de suministro
    • Inventario
    • Fabricación
    • PLM
    • Compra
    • Mantenimiento
    • Calidad
    Recursos Humanos
    • Empleados
    • Reclutamiento
    • Ausencias
    • Evaluación
    • Referencias
    • Flota
    Marketing
    • Marketing social
    • Marketing por correo electrónico
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyecto
    • Partes de horas
    • Servicio de campo
    • Servicio de asistencia
    • Planificación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Información
    • WhatsApp
    Aplicaciones de terceros Studio de Odoo Plataforma de Odoo Cloud
  • Industrias
    Comercio al por menor
    • Librería
    • Tienda de ropa
    • Tienda de muebles
    • Tienda de ultramarinos
    • Ferretería
    • Juguetería
    Food & Hospitality
    • Bar y taberna
    • Restaurante
    • Comida rápida
    • Guest House
    • Distribuidor de bebidas
    • Hotel
    Real Estate
    • Real Estate Agency
    • Estudio de arquitectura
    • Construcción
    • Gestión inmobiliaria
    • Jardinería
    • Asociación de propietarios
    Consulting
    • Accounting Firm
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Fabricación
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Regalos de empresas
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Terapeutas
    • Farmacia
    • Peluquería
    Trades
    • Handyman
    • Hardware y asistencia informática
    • Solar Energy Systems
    • Zapatero
    • Servicios de limpieza
    • HVAC Services
    Others
    • Nonprofit Organization
    • Agencia de protección del medio ambiente
    • Alquiler de paneles publicitarios
    • Estudio fotográfico
    • Alquiler de bicicletas
    • Distribuidor de software
    Browse all Industries
  • Comunidad
    Aprender
    • Tutoriales
    • Documentación
    • Certificaciones
    • Formación
    • Blog
    • Podcast
    Potenciar la educación
    • Programa de formación
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtener el software
    • Descargar
    • Comparar ediciones
    • Versiones
    Colaborar
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Convertirse en partner
    • Services for Partners
    • Registrar tu empresa contable
    Obtener servicios
    • Encontrar un partner
    • Encontrar un asesor fiscal
    • Contacta con un experto
    • Servicios de implementación
    • Referencias de clientes
    • Ayuda
    • Actualizaciones
    GitHub YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicitar 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
  • Proyecto
  • 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

Odoo auto attach pdf in email

Suscribirse

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

Se marcó esta pregunta
wizardrmlreportsodoo
5 Respuestas
19881 Vistas
Avatar
Ashish Singh

Hello Guys,

I am working on timesheet module odoo of some report generation,

In Timesheet Activity Tree view  once we select any record More option will display, in More option i had put one button that call one wizard. In that wizard i had put two button one is generating report(RML Report) (list of all timesheet line based on Analytical Account).

and other button send a mail to a client of Analytical Account , Now here i get stuck that how can i automatically attach a pdf report which i had generated or it automatically generate new pdf and attach automatically in email.

0
Avatar
Descartar
Cyril Gaspard (GEM)

Hi,do you use a template to send email ? Secondly, does your pdf is store in attachment or dynamically from where and how? bye

Avatar
Umashankar Subramani
Mejor respuesta

Hi kumar,

   First you need to create a template for your email ,settings->email->template-> create -> Name-(User defined), Applies to- description to model, model- model for creating email, and you can give acces rights, on the content tab you need create the template. In email configuration you need to configure your email address for sender and receiver. And in advanced setting you have an option that you can add a attachment automatically by giving the optional report to print or attach and save the template.

1
Avatar
Descartar
Cyril Gaspard (GEM)

Hi, with your solution, an ir_attachment is created, but Kumar do not want this. Bye

Bertus Kruger

Thanks for this. It helped me with my missing invoice attachments. :)

Avatar
Ashish Singh
Autor Mejor respuesta

I had made one email template for sending mail, and initially my pdf is not store in attachment, i want to add dynamically.

Means once i click a button called send email , one function call that  internally call my email template and send msg to client, but in that mail i want to also attach my pdf which  automatically( its call generate pff method and attach in email)

1
Avatar
Descartar
Umashankar Subramani

I have tried that in Qweb report pls try this.............. https://www.odoo.com/forum/help-1/question/how-to-send-email-76125#answer-76136

Avatar
Cyril Gaspard (GEM)
Mejor respuesta

Hi,

in function you call by pushing your button, when you call method send_mail of model email_template ((module email_template), add in context all informations you need to build your pdf and id of the email in a list with key 'add_pdf': [email_id, 'file_name.pdf', ....]. for function parameter 'force_send'  set value True, then the method send of mail_mail model module mail) will be called by inheriting the context.

In this function, variable attachments contains files to send with code:


# load attachment binary data with a separate read(), as prefetching all

# `datas` (binary field) could bloat the browse cache, triggerring

# soft/hard mem limits with temporary data.

attachment_ids = [a.id for a in mail.attachment_ids]

attachments = [(a['datas_fname'], base64.b64decode(a['datas']))

for a in ir_attachment.read(cr, SUPERUSER_ID, attachment_ids,

     ['datas_fname', 'datas'])]


you should override after this code in your module by overriding method send:

+ test if key 'add_pdf' is in the context

+ if yes test email_id of the key 'add_pdf' with current email_id of function send of the for loop.

+ if yes, call your function which genarates your pdf using informations you have in key 'add_pdf' and had tuple ('file_name.pdf', file) to the variable attachments list

bye

1
Avatar
Descartar
Ashish Singh
Autor

Can u explain in details

Avatar
Cybrosys Techno Solutions Pvt.Ltd
Mejor respuesta

Hi,

You can refer the blog

https://www.cybrosys.com/blog/how-to-add-email-attachments-pdf-excel-in-odoo-16

This blog provides a step-by-step guide on how to add email attachments (PDF/Excel) in Odoo 16. It includes creating a new module, defining methods to generate and return the PDF report, and sending the email with the PDF report .

Regards

0
Avatar
Descartar
Avatar
Maduka Sopulu
Mejor respuesta

The answers provided here is for odoo 10 or below;

Here is a sample code done to generate Pdf and save to attachment using render_qweb_pdf for sending mail: 

def generate_report_file(self, id):
        pdf = self.env.ref('mymodule.action_report_labtest').render_qweb_pdf(id)[0]
        pdf = base64.b64encode(pdf)
        return pdf
So, you can return pdf as a binary to any binary field as this;
self.binary_field = self.generate_report_file(idoftherecord.id)

You can attach it to an attachment like this;
report_binary = self.generate_report_file(LabObj.id)
attachmentObj = self.env['ir.attachment'].create({
                'name': attachment_name,
                'type': 'binary',
                'datas': report_binary,
                'datas_fname': attachment_name + '.pdf',
                'store_fname': attachment_name,
                'res_model': self._name,
                'res_id': self.id,
                'mimetype': 'application/x-pdf'
            })

@Maduka Sopulu Chris 

0
Avatar
Descartar
¿Le interesa esta conversación? ¡Participe en ella!

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

Inscribirse
Publicaciones relacionadas Respuestas Vistas Actividad
Report not working
rml reports odoo
Avatar
0
may 15
6300
What is the difference between t-esc and t-raw ? Resuelto
reports odoo
Avatar
Avatar
Avatar
2
dic 23
61130
What are the css class available for odoo reporting ? Where we can find it ? Resuelto
reports odoo
Avatar
Avatar
Avatar
3
dic 23
20832
ODOO: ValueError: External ID not found in the system: hr_payroll.payslip_pdf
rml odoo
Avatar
Avatar
1
mar 16
16151
How do I print a report AND keep the wizard open?
wizard reports
Avatar
Avatar
1
sept 15
4829
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento Odoo.sh
  • Ayuda
  • Actualizar
  • Desarrollos personalizados
  • Educación
  • Encontrar un asesor fiscal
  • Encontrar un partner
  • Convertirse en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contacta con nosotros
  • Puestos de trabajo
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Información 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 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