Перейти к содержимому
Odoo Меню
  • Войти
  • Попробовать бесплатно
  • Модули
    Финансы
    • Бухгалтерия
    • Выставление счетов
    • Расходы
    • Таблицы
    • Документооборот
    • Подпись
    Продажи
    • CRM
    • Продажи
    • POS Магазин
    • POS Ресторан
    • Подписки
    • Аренда
    Вебсайты
    • Конструктор вебсайтов
    • eCommerce
    • Блог
    • Форум
    • Онлайн-чат
    • Электронное обучение
    Логистика
    • Склад
    • Производство
    • PLM
    • Закупки
    • Обслуживание
    • Качество
    Отдел кадров
    • Сотрудники
    • Подбор персонала
    • Отпуска
    • Оценка персонала
    • Реферальная программа
    • Автопарк
    Маркетинг
    • SMM
    • E-mail рассылки
    • СМС рассылки
    • Мероприятия
    • Автоматизация маркетинга
    • Опросы
    Услуги
    • Проекты
    • Табели
    • Выездной сервис
    • Поддержка
    • Планирование
    • Встречи
    Продуктивность
    • Обсуждения
    • Согласование
    • IoT
    • VoIP-телефония
    • Knowledge
    • WhatsApp
    Сторонние приложения Модуль Студия Odoo Платформа Odoo Cloud
  • Индустрии
    Розничная торговля
    • Книжный магазин
    • Магазин одежды
    • Мебельный магазин
    • Продуктовый магазин
    • Строительный магазин
    • Магазин игрушек
    Гостинично-ресторанный бизнес
    • Бар и паб
    • Ресторан
    • Фастфуд
    • Гостевой дом
    • Дистрибьютор напитков
    • Отель
    Недвижимость
    • Агентство недвижимости
    • Архитектурное бюро
    • Строительство
    • Управление недвижимостью
    • Ландшафтный дизайн
    • Товарищество собственников жилья
    Консалтинг
    • Бухгалтерская фирма
    • Партнер Odoo
    • Маркетинговое агентство
    • Юридическая фирма
    • Подбор персонала
    • Аудиторское бюро
    Производство
    • Текстиль
    • Металл
    • Мебель
    • Продукты питания
    • Пивоварня
    • Корпоративные сувениры
    Здоровье и фитнес
    • Спортивный комплекс
    • Магазин оптики
    • Фитнес-клуб
    • Велнес-центр
    • Аптека
    • Салон красоты
    Услуги
    • Специалист по бытовым услугам
    • Продажа и обслуживание IT-оборудования
    • Солнечные энергосистемы
    • Производство обуви
    • Клининг
    • Системы ОВКВ
    Прочее
    • Некоммерческая организация
    • Консалтинг в сфере устойчивого развития
    • Аренда рекламных щитов
    • Бизнес по фотосъемке
    • Прокат велосипедов
    • Реселлер программного обеспечения
    Все индустрии
  • Community
    Обучение
    • Видео уроки
    • Документация
    • Сертификация
    • Тренинг
    • Блог
    • Подкаст
    Образование и развитие
    • Образовательная программа
    • Деловая игра Scale Up!
    • Экскурсия в офис Odoo
    ПО
    • Скачать
    • Сравнить версии
    • Релизы
    Сотрудничество
    • Github
    • Форум
    • Мероприятия
    • Перевод
    • Стать партнером
    • Услуги для партнеров
    • Зарегистрировать бухгалтерскую фирму
    Услуги
    • Найти партнера
    • Найти бухгалтера
    • Встреча с экспертом
    • Услуги по внедрению
    • Отзывы клиентов
    • Поддержка
    • Обновления
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Заказать демонстрацию
  • Цены
  • Поддержка

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

  • CRM
  • e-Commerce
  • Бухгалтерия
  • Склад
  • PoS
  • Проекты
  • MRP
All apps
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Все посты Люди Значки
Теги (Смотреть все)
odoo accounting v14 pos v15
Об этом форуме
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Все посты Люди Значки
Теги (Смотреть все)
odoo accounting v14 pos v15
Об этом форуме
Помощь

Odoo auto attach pdf in email

Подписаться

Получайте уведомления о появлении активности в этом посте

Этот вопрос был отмечен
wizardrmlreportsodoo
5 Ответы
19880 Представления
Аватар
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
Аватар
Отменить
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

Аватар
Umashankar Subramani
Лучший ответ

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
Аватар
Отменить
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. :)

Аватар
Ashish Singh
Автор Лучший ответ

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
Аватар
Отменить
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

Аватар
Cyril Gaspard (GEM)
Лучший ответ

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
Аватар
Отменить
Ashish Singh
Автор

Can u explain in details

Аватар
Cybrosys Techno Solutions Pvt.Ltd
Лучший ответ

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
Аватар
Отменить
Аватар
Maduka Sopulu
Лучший ответ

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
Аватар
Отменить
Не оставайтесь в стороне – присоединяйтесь к обсуждению!

Создайте аккаунт сегодня, чтобы получить доступ к эксклюзивным функциям и стать частью нашего замечательного сообщества!

Регистрация
Похожие посты Ответы Просмотры Активность
Report not working
rml reports odoo
Аватар
0
мая 15
6300
What is the difference between t-esc and t-raw ? Решено
reports odoo
Аватар
Аватар
Аватар
2
дек. 23
61129
What are the css class available for odoo reporting ? Where we can find it ? Решено
reports odoo
Аватар
Аватар
Аватар
3
дек. 23
20831
ODOO: ValueError: External ID not found in the system: hr_payroll.payslip_pdf
rml odoo
Аватар
Аватар
1
мар. 16
16150
How do I print a report AND keep the wizard open?
wizard reports
Аватар
Аватар
1
сент. 15
4829
Сообщество
  • Видео уроки
  • Документация
  • Форум
Открытый исходный код
  • Скачать
  • Github
  • Runbot
  • Перевод
Услуги
  • Хостинг Odoo.sh
  • Поддержка
  • Обновление
  • Индивидуальные решения по доработке
  • Образование
  • Найти бухгалтера
  • Найти партнера
  • Стать партнером
О нас
  • Наша компания
  • Активы бренда
  • Cвяжитесь с нами
  • Вакансии
  • Мероприятия
  • Подкаст
  • Блог
  • Клиенты
  • Правовые документы • Конфиденциальность
  • Безопасность
الْعَرَبيّة 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 – это набор бизнес-модулей с открытым исходным кодом, который закроет все потребности вашей компании: CRM, E-commerce, Бухгалтерия, Склад, POS, управление проектами и др.

Odoo сочетает в себе простоту использования и полную интеграцию всех бизнес-процессов в одной системе.

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