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

Attach Report While Printing

Abonare

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

Această întrebare a fost marcată
reportingattachmentsodoo10odoo10.0
1 Răspunde
12056 Vizualizări
Imagine profil
Sebin Siby

I have a report in account.invoice which have a wizard of model invoice.details.

While the report is printed I need to automatically attach the file to the attachment drop down of corresponding invoice.

How is this possible? Anyone have idea?

0
Imagine profil
Abandonează
Imagine profil
Niyas Raphy (Walnut Software Solutions)
Cel mai bun răspuns

Hi,

For the reports  to save in the attachments button in the top of the form view, add a attachments in the report tag you have given for the report.

<report     
string="Request for Quotation"
id="report_purchase_quotation"
model="purchase.order"
report_type="qweb-pdf"
name="purchase.report_purchasequotation"
file="purchase.report_purchasequotation"
attachment="(object.name + '_test_report.pdf')"/>/>

Normally this will save the downloaded reports to  the attachments button, see Quotation /Order in sales.

For attachments button to visible in all view, install the module document(technical name)

Check whether it will work in your case.

This is a sample code for creating an attachment and it will show in attachment button in top of the form too

attachment_model = request.env['ir.attachment']
byte_str = kw['attachments[4]'].read()
uploaded_file = base64.encodestring(byte_str)
vals = {
'name': kw['attachments[4]'].filename,
'res_model': model_name,
'res_id': new_record.id,
'datas': uploaded_file}
attachments_record = attachment_model.sudo().create(vals)

Thanks

1
Imagine profil
Abandonează
Sebin Siby
Autor

I have tried this and didn't worked. I have to do it from the code

Niyas Raphy (Walnut Software Solutions)

just updated the answer, check it can help you or not

Sebin Siby
Autor

I have tried the code below. I get error showing 'my.model' object has no attribute 'custom_name'.

I am calling this function from print function in my wizard and my wizard have field 'custom_name'. Wizard is called from 'my.model' form view.

def attach_report(self):

attachment_obj = self.env['ir.attachment']

for record in self:

ir_actions_report = self.env['ir.actions.report.xml']

matching_reports = ir_actions_report.search([('report_name','=','module_name.report_template')])

if matching_reports:

report = matching_reports[0]

report_service = report.report_name

result, format = odoo_report.render_report(self._cr, self._uid, [record.id], report_service, {'model': self._name}, self._context)

eval_context = {'time': time, 'object': record}

if not report.attachment or not eval(report.attachment, eval_context):

# no auto-saving of report as attachment, need to do it manually

result = base64.b64encode(result)

file_name = re.sub(r'[^a-zA-Z0-9_-]', '_', "Report Name Here")

file_name += ".pdf"

attachment_id = attachment_obj.create({

'name': file_name,

'datas': result,

'datas_fname': file_name,

'res_model': 'my.model',

'res_id': self._context.get('active_id', False),

'type': 'binary'

})

return True

Sebin Siby
Autor

I know how to use this. But it is attaching to the model of wizard. I want it to attach to the corresponding record from which the report is called.

<report

string="Request for Quotation"

id="report_purchase_quotation"

model="purchase.order"

report_type="qweb-pdf"

name="purchase.report_purchasequotation"

file="purchase.report_purchasequotation"

attachment="(object.name + '_test_report.pdf')"/>/>

shalin wilson

how to attach a pdf file to a report?

i just want to add spec sheet of a product to the product report

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
Attachment Issues Odoo 10 CE
attachments odoo10
Imagine profil
0
ian. 19
3272
How to upload attachment in the bank statement line?
attachments odoo10.0
Imagine profil
0
nov. 18
3631
How to groups the same value report in QWEB Odoo Rezolvat
reporting group_by qweb-report odoo10 odoo10.0
Imagine profil
Imagine profil
Imagine profil
4
aug. 18
8909
Odoo10: Binary fields to file in ir.attachment
odoo10 odoo10.0
Imagine profil
Imagine profil
1
nov. 17
10998
Version 10.0: localhost refused to connect Rezolvat
odoo10 odoo10.0
Imagine profil
Imagine profil
Imagine profil
Imagine profil
6
dec. 23
21072
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