Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Jídlo a pohostinství
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Penzion
    • Distributor nápojů
    • Hotel
    Nemovitost
    • Realitní kancelář
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Poradenství
    • Účetní firma
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textile
    • Kov
    • Nábytek
    • Jídlo
    • Brewery
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Transakce
    • Údržbář
    • IT hardware a podpora
    • Systémy solární energie
    • Výrobce obuvi
    • Úklidové služby
    • Služby HVAC
    Ostatní
    • Nezisková organizace
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Browse all Industries
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Services for Partners
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

How to generate a single pdf of multiple reports of the same template?

Odebírat

Get notified when there's activity on this post

This question has been flagged
pdfreportsodoo10
9 Odpovědi
21672 Zobrazení
Avatar
Samo Arko

I would like to know how can I download/print a single pdf that has multiple reports of the same template.

At the moment I can download only a single report per child, but I want to have them all in a single pdf when I print them from the parent. In my views I use buttons in the header to get the report.

<header>
	<button name="%(action_report_salary_all_details)d" string="Salary (details)" type="action" style="margin-right: 5px;"/>
	<button name="%(action_report_salary_few_details)d" string="Salary" type="action"/>
</header>

My report code for the child model (parent is 'hr.history.salary' and it is in One2Many relation with child):

class ReportSalaryFewDetails(models.AbstractModel):
    _name = 'report.hr.report_salary_few_details'

    @api.model
    def render_html(self, docids, data=None):
        payslips = self.env['hr.history.salary.salary_slips'].browse(docids)
        docargs = {
            'doc_ids': docids,
            'doc_model': 'hr.history.salary.salary_slips',
'docs': payslips, 'data': data, } return self.env['report'].render('my_addon.report_salary_few_details', docargs)

Do I have to create a whole new report so I can call it from the parent or can I modify this code and how to print them all in one pdf? 





0
Avatar
Zrušit
Avatar
Samo Arko
Autor Nejlepší odpověď

I finally figured it out with the get_pdf() method. 

def save_reports_file(self):
        report_ids = self.env['hr.myreport.datas'].search([('report_id', '=', self.id)]).ids
        report_name = "module.report_name"
        pdf = self.env['report'].sudo().get_pdf(report_ids, report_name)
        self.reports_file = base64.encodestring(pdf)

 

1
Avatar
Zrušit
Avatar
Tara Chand Kumawat
Nejlepší odpověď

I know get_pdf() method works for ODOOV10. i.e.

self.env['report'].sudo().get_pdf(obj.id, 'module_name.report_template_xml_id)

In V12 issue can solve this way:

report_sudo = self.env['ir.actions.report']._get_report_from_name('module_name.report_template_xml_id')  # report action
pdf_content = getattr(report_sudo, 'render_qweb_pdf')([obj.id], data={'report_type': 'pdf'})[0]

2
Avatar
Zrušit
Avatar
ITStore
Nejlepší odpověď


Try this modules:

Print Multiple Reports In Single File

Print Multiple Invoice Reports To Single File

Print Multiple Sales Reports To Single File


0
Avatar
Zrušit
Avatar
Fatih Piristine
Nejlepší odpověď

invoice tree view has print invoices function. check how it is done, it might give you the idea.

see NIyas's answer here: https://www.odoo.com/forum/help-1/question/mass-downloading-invoices-126451

0
Avatar
Zrušit
Samo Arko
Autor

I need it to work from a custom button in a view. At least tell me the name of the module so I can view the source files. The answer in the link isn't helpful! I need a code example not how a end user can do it.

Fatih Piristine

i thought you would notice it from attached picture. it is in accounting / customer invoices. and there is no other ready code I know of. you can do it and share it.

Samo Arko
Autor

the picture is a bit small so I didn't really see the menu items good. But now I have to figure out what addon modul has this code.

Niyas Raphy (Walnut Software Solutions)

Hi,

just pass the required id's of the records in docids

Samo Arko
Autor

tried that before posting question because in the template is <t t-foreach="docs" t-as="o">, but it didn't work. Or I just don't know how to do it right.

Enjoying the discussion? Don't just read, join in!

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

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
PDF report name isn't respected when using module from app store
pdf reports
Avatar
0
zář 21
3369
PDF reports show negative amounts with vertical bar "|" instead of "-". How can I fix this.?
pdf reports
Avatar
Avatar
1
kvě 18
4377
No css format on PDF reports after upgrade Odoo Server 10.0-20170119 ! (no headers) Vyřešeno
pdf reports
Avatar
Avatar
2
led 17
7520
Reports not auto-saved to attachments Vyřešeno
pdf reports
Avatar
Avatar
Avatar
3
bře 15
8241
Add Customer Name to Printed Reports Name Vyřešeno
pdf reports 17.2
Avatar
Avatar
Avatar
2
říj 24
3008
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 je balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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