Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

Generate and store a pdf or send by mail

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
pdfreportingv15
2622 Vizualizări
Imagine profil
Marcos

Hey guys, I made a form that when u tell to print, it downloads the pdf, but i want not to download it local, i want to send it by mail to a direction, but im not able to do that by the moment, i thought to make that when i create the a new form, when the users saves the info to generate it, and then when it says print, to send it by mail to the direction of the printer, the code i used to download it

def action_report(self):       

return self.env.ref('base_icg.action_report_op_ticket').report_action(self)

but i dont know how to store it i tried like this (ChatGPT) but it crashes code error pdf, any clues or other ways thanks a lot 
 
def action_report(self):    
        report_action = self.env.ref('base_icg.action_report_op_ticket').report_action(self)                  ​pdf_content = report_action['pdf'][0]

        return pdf_content

      @api.model    def create(self, vals):       

 if vals.get('orden_trabajo', _('New')) == _('New'):           

 if vals.get('bool_taller'):                sequence_code = 'fichas'            

else:                

sequence_code = 'parte'           

 sequence_number = self.env['ir.sequence'].next_by_code(sequence_code) or _('New')            vals['name'] = sequence_number        

result = super(Parte, self).create(vals)     

   pdf_content = result.action_report()       

 result.write({'pdf_field': pdf_content})        

return result

**UPDATE
Im able to store it in a field and preview it with this method
pdf_content = fields.Binary(string='PDF generado')   
def action_report(self):       
​report_template_id=self.env.ref('base_icg.action_report_op_ticket')._render_qweb_pdf(self.ids)        report_data = report_template_id[0]               
# Convertir los datos del informe a bytes       
report_bytes = base64.b64encode(report_data)               
# Crear el registro de ir.attachment       
attachment_values = {           
'name': "Informe.pdf",           
'type': 'binary',           
'datas': report_bytes,           
'store_fname': "Informe.pdf",           
'mimetype': 'application/x-pdf',        }     
  attachment = self.env['ir.attachment'].create(attachment_values)           
    # Almacenar el ID del archivo adjunto en el campo pdf_content       
self.pdf_content = attachment.datas               
return True
 
0
Imagine profil
Abandonează
Enjoying the discussion? Don't just read, join in!

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

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
Report layout, paper format: margins and spacing
pdf reporting paperformat v15
Imagine profil
Imagine profil
1
mar. 23
7226
ODOO 15 for "Einnahmenüberschussrechnung EÜR"
reporting v15
Imagine profil
Imagine profil
Imagine profil
2
aug. 25
3954
report layout generates error on pdf export but works in preview
reporting v15
Imagine profil
Imagine profil
1
apr. 25
5407
Reports: table headers repeating PO vs SO Rezolvat
reporting v15
Imagine profil
Imagine profil
2
iul. 24
6986
Insert image into a report Rezolvat
reporting v15
Imagine profil
Imagine profil
1
apr. 24
2748
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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