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í
    Food & Hospitality
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Guest House
    • Distributor nápojů
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Trades
    • Údržbář
    • IT hardware a podpora
    • Solar Energy Systems
    • Výrobce obuvi
    • Úklidové služby
    • HVAC Services
    Others
    • Nonprofit Organization
    • 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

Generate PDF Report From Wizard

Odebírat

Get notified when there's activity on this post

This question has been flagged
accountingwizardreportingreport
2 Odpovědi
7910 Zobrazení
Avatar
Kevin

Hello, can someone help me, I want to generate a pdf from a wizard, I already have the template and the xml action, but when I call the wizard method to generate the pdf, it generates it blank without any information, currently what the wizard does is generate a ledger modified to another tree view of another model, so I want the option to also generate it in pdf with the same information of the method that it generates when generating the other view:

This is the method that generates another view of another model with the info:

def confirm_export(self):
move_lines = self.env['account.move.line'].search([
('account_id', 'in', self.account_ids.ids),
('date', '>=', self.start_date),
('date', '<=', self.end_date),
('move_id.state', '=', 'posted'), # Filtrar movimientos publicados
])

ledger_view_records = defaultdict(lambda: {'debit_total': 0.0, 'credit_total': 0.0, 'balance_total': 0.0,
'balance_acumulado': 0.0})
for move_line in move_lines.sorted(key=lambda r: r.date):
key = (move_line.date, move_line.journal_id, move_line.account_id)
ledger_view_records[key]['account_id'] = move_line.account_id.id
ledger_view_records[key]['journal_id'] = move_line.journal_id.id
ledger_view_records[key]['date'] = move_line.date
ledger_view_records[key]['currency_id'] = move_line.currency_id.id
ledger_view_records[key]['debit_total'] += move_line.debit
ledger_view_records[key]['credit_total'] += move_line.credit
ledger_view_records[key]['balance_acumulado'] += move_line.cumulated_balance
ledger_view_records[key]['balance_total'] += move_line.balance

export_general_ledger_view = self.env['export.general.ledger.view']
created_records = export_general_ledger_view.create(list(ledger_view_records.values()))

# Abrir la vista después de guardar los datos
action = self.env.ref('general_ledger_sv.action_export_general_ledger_view').read()[0]
action['domain'] = [('id', 'in', created_records.ids)]
return action

This is the xml action and template id:

<record id="report_general_ledger" model="ir.actions.report">
<field name="name">Libro Mayor PDFfield>
<
field name="model">export.general.ledger.viewfield>
<
field name="report_type">qweb-pdffield>
<
field name="report_name">general_ledger_sv.report_general_ledger_sv_template_idfield>
<
field name="report_file">general_ledger_sv.report_general_ledger_sv_template_idfield>
<
field name="binding_model_id" ref="general_ledger_sv.model_export_general_ledger_view"/>
<
field name="binding_type">reportfield>
<
field name="binding_view_types">treefield>
record>

This is the current method to export to pdf:


def generate_pdf(self):
# Obtener los valores del modelo export.general.ledger.view
ledger_view = self.env['export.general.ledger.view'].browse(self._context.get('active_ids', []))

data = {
'model_id': ledger_view.id,
'date': ledger_view.date,
'account_id': ledger_view.account_id,
'journal_id': ledger_view.journal_id,
'debit_total': ledger_view.debit_total,
'credit_total': ledger_view.credit_total,
'balance_total': ledger_view.balance_total,
'balance_acumulado': ledger_view.balance_acumulado,
'currency_id': ledger_view.currency_id,
}

docids = ledger_view.ids
return self.env.ref('general_ledger_sv.report_general_ledger').report_action(docids=docids, data=data)
0
Avatar
Zrušit
Avatar
Niyas Raphy (Walnut Software Solutions)
Nejlepší odpověď

Hi,

When you are printing the data from wizard the data may not have been passed to the report and thus it fails to render the values in the template.

You can check the values, you are returning inside the variable docids and data from wizard and ensure the needed values are passed.

Also you can check out this video explaining the same:  https://www.youtube.com/watch?v=3UJ8UfP48B4


Thanks

0
Avatar
Zrušit
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Nejlepší odpověď

Hi,
In certain conditions, we need to print the report from a button or wizard. In that condition, we use the print button inside the wizard or form to call the report action.

Please refer to the blog topic How to Create a PDF Report in Odoo :https://www.cybrosys.com/blog/how-to-create-a-pdf-report-in-odoo-15

Hope it helps

0
Avatar
Zrušit
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
How to generate a report from a wizard?
wizard reporting report
Avatar
Avatar
1
dub 24
33086
Odoo Online 18.4: Mapping Spanish Chart of Accounts to US for Trial Balance Report Vyřešeno
accounting reporting
Avatar
Avatar
1
říj 25
405
What types of subformulas are there in a financial report? Vyřešeno
accounting report
Avatar
Avatar
1
zář 25
1415
What content in Python files for report invoice document
accounting reporting
Avatar
1
dub 25
2068
How to perform automatic year-end accounting entries?
accounting reporting
Avatar
0
bře 25
1815
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