Zum Inhalt springen
Odoo Menü
  • Anmelden
  • Jetzt gratis testen
  • Apps
    Finanzen
    • Buchhaltung
    • Rechnungsstellung
    • Spesenabrechnung
    • Tabellenkalkulation (BI)
    • Dokumente
    • E-Signatur
    Vertrieb
    • CRM
    • Vertrieb
    • Kassensystem – Shop
    • Kassensystem – Restaurant
    • Abonnements
    • Vermietung
    Websites
    • Website-Builder
    • E-Commerce
    • Blog
    • Forum
    • Livechat
    • E-Learning
    Lieferkette
    • Lager
    • Fertigung
    • PLM
    • Einkauf
    • Wartung
    • Qualität
    Personalwesen
    • Mitarbeiter
    • Personalbeschaffung
    • Abwesenheiten
    • Mitarbeiterbeurteilung
    • Personalempfehlungen
    • Fuhrpark
    Marketing
    • Social Marketing
    • E-Mail-Marketing
    • SMS-Marketing
    • Veranstaltungen
    • Marketing-Automatisierung
    • Umfragen
    Dienstleistungen
    • Projekte
    • Zeiterfassung
    • Außendienst
    • Kundendienst
    • Planung
    • Termine
    Produktivität
    • Dialog
    • Genehmigungen
    • IoT
    • VoIP
    • Wissensdatenbank
    • WhatsApp
    Apps von Drittanbietern Odoo Studio Odoo Cloud-Plattform
  • Branchen
    Einzelhandel
    • Buchladen
    • Kleidergeschäft
    • Möbelhaus
    • Lebensmittelgeschäft
    • Baumarkt
    • Spielwarengeschäft
    Essen & Gastgewerbe
    • Bar und Kneipe
    • Restaurant
    • Fast Food
    • Gästehaus
    • Getränkehändler
    • Hotel
    Immobilien
    • Immobilienagentur
    • Architekturbüro
    • Baugewerbe
    • Immobilienverwaltung
    • Gartenarbeit
    • Eigentümervereinigung
    Beratung
    • Buchhaltungsfirma
    • Odoo-Partner
    • Marketingagentur
    • Anwaltskanzlei
    • Talentakquise
    • Prüfung & Zertifizierung
    Fertigung
    • Textil
    • Metall
    • Möbel
    • Speisen
    • Brauerei
    • Firmengeschenke
    Gesundheit & Fitness
    • Sportklub
    • Brillengeschäft
    • Fitnessstudio
    • Therapeut
    • Apotheke
    • Friseursalon
    Handel
    • Handyman
    • IT-Hardware & -Support
    • Solarenergiesysteme
    • Schuster
    • Reinigungsdienstleistungen
    • HLK-Dienstleistungen
    Sonstiges
    • Gemeinnützige Organisation
    • Umweltschutzagentur
    • Plakatwandvermietung
    • Fotostudio
    • Fahrrad-Leasing
    • Software-Händler
    Alle Branchen ansehen
  • Community
    Lernen
    • Tutorials
    • Dokumentation
    • Zertifizierungen
    • Schulung
    • Blog
    • Podcast
    Bildung fördern
    • Bildungsprogramm
    • Scale-Up! Planspiel
    • Odoo besuchen
    Software anfragen
    • Herunterladen
    • Editionen vergleichen
    • Releases
    Zusammenarbeiten
    • Github
    • Forum
    • Veranstaltungen
    • Übersetzungen
    • Partner werden
    • Dienstleistungen für Partner
    • Buchhaltungsfirma registrieren
    Services anfragen
    • Partner finden
    • Buchhalter finden
    • Einen Experten treffen
    • Implementierungsservices
    • Kundenreferenzen
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Eine Demo erhalten
  • Preiskalkulation
  • Hilfe

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

  • CRM
  • e-Commerce
  • Buchhaltung
  • Lager
  • PoS
  • Projekte
  • MRP
All apps
Sie müssen registriert sein, um mit der Community zu interagieren.
Alle Beiträge Personen Abzeichen
Stichwörter (Alle anzeigen)
odoo accounting v14 pos v15
Über dieses Forum
Sie müssen registriert sein, um mit der Community zu interagieren.
Alle Beiträge Personen Abzeichen
Stichwörter (Alle anzeigen)
odoo accounting v14 pos v15
Über dieses Forum
Hilfe

Why is my custom invoice report only being printed in the draft state and not in invoice state?

Abonnieren

Erhalten Sie eine Benachrichtigung, wenn es eine Aktivität zu diesem Beitrag gibt

Diese Frage wurde gekennzeichnet
qwebinvoicesprintingreportsodoo8.0
2 Antworten
11289 Ansichten
Avatar
Yenthe Van Ginneken (Mainframe Monkey)

Hi everybody

I've set up a second report for invoices. I want an alternative report option in the print dropdown so I created a second report in the account module.

I've added a report in account_report.xml under /addons/account/ like this:

        <report 
            id="account_invoices"
            model="account.invoice"
            string="Invoices"
            report_type="qweb-pdf"
            name="account.report_invoice"
            file="account.report_invoice"
            attachment_use="True"
            attachment="(object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')"
        />

    <!--Custom report link->
        <report 
            id="account_aangetekend"
            model="account.invoice"
            string="Aangetekende zending"
            report_type="qweb-pdf"
            name="account.report_aangetekend"
            file="account.report_aangetekend"
        />

Then I added an XML file, named report_aangetekend.xml with 95% the same code as the 'normal' report (coming from report_invoice.xml). I've only changed the names and added one field.

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="report_aangetekend_document">
    <t t-call="report.external_layout">
        <div class="page">
            <div class="row">
                <div class="col-xs-5 col-xs-offset-7">
                    <address t-field="o.partner_id"
                        t-field-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": true}' />
                    <span t-field="o.partner_id.vat"/>
                </div>
            </div>
<p>TEST</p>
<!--Lots of other, irrelevant code here-->
</div>
</t>
</template>

<template id="report_aangetekend">
    <t t-call="report.html_container">
        <t t-foreach="doc_ids" t-as="doc_id">
            <t t-raw="translate_doc(doc_id, doc_model, 'partner_id.lang', 'account.report_aangetekend_document')"/>
        </t>
    </t>
</template>
</data>
</openerp>

The report works, is showing up and I can print it. There is however a strange effect.
If I now create a new invoice (in draft modus) and choose the two different print options I'll get two different report prints, so far so good, as you can see here.


If I now make a second invoice, validate this and then print out the two different reports I'll get the same report twice. Both coming from the file report_invoice.xml (addons/account/views/). As you can see here:


Is there a reason why my custom report is not being printed in validated state but it is in draft? Do I have to define something more elsewhere or what am I missing?

With kind regards
Yenthe
 

0
Avatar
Verwerfen
Avatar
Zbik
Beste Antwort

Probably your report is printed from an attachment in both cases. If standard invoice state is ('open','paid') the attachment is generated, in state 'draft' no attachment.

0
Avatar
Verwerfen
Yenthe Van Ginneken (Mainframe Monkey)
Autor

@zbik that is correct, at the moment I have both set to attachment_use="True" but even if I only set one or none I still don't get the wished result. Could you give me some more details about what is wrong/how to fix it?

Zbik

Do you have removed the old attachment? In my opinion, if attachment_use="False", should work.

Zbik

My solution: https://www.odoo.com/forum/help-1/question/how-we-inherit-invoice-report-to-change-the-attachment-attribute-on-odoo-v8-69628

Yenthe Van Ginneken (Mainframe Monkey)
Autor

@zbik even if I set both attachment_use="False" there is no difference. When the invoice is validated both versions will print the original sadly. Any more ideas / solutions?

Zbik

Erase attachment="(object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')". Your code xml (deleted all attachment lines) normally working on my tmp system. I think this is an Odoo error with attachment_use="False", if attachment='xxx' not empty.

Avatar
Yenthe Van Ginneken (Mainframe Monkey)
Autor Beste Antwort

I've found the solution and it was very simple. I just had to set both records to attachment_use="True" and had to give them both a different name.
I have no idea why the two different names fixed it though. Those two files are added as an attachment and that seems to do the trick.

Final code:

        <report 
            id="account_invoices"
            model="account.invoice"
            string="Invoices"
            report_type="qweb-pdf"
            name="account.report_invoice"
        attachment_use="True"
            attachment="(object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')"
            file="account.report_invoice"
        />

    <!--Custom-->
        <report 
            id="account_aangetekend"
            model="account.invoice"
            string="Aangetekende zending"
            report_type="qweb-pdf"
            name="account.report_aangetekend"
            attachment_use="True"
           <!--This one has to have a different name then the other one. The magic happens here.-->
            attachment="(object.state in ('open','paid')) and ('INV2'+(object.number or '').replace('/','')+'.pdf')"
            file="account.report_aangetekend"
        />

If you don't want any files attached under attachments there is a second solution:

        <report 
            id="account_invoices"
            model="account.invoice"
            string="Invoices"
            report_type="qweb-pdf"
            name="account.report_invoice"
        attachment_use="True"
            attachment="(object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')"
            file="account.report_invoice"
        />

    <!--Custom-->
        <report 
            id="account_aangetekend"
            model="account.invoice"
            string="Aangetekende zending"
            report_type="qweb-pdf"
            name="account.report_aangetekend"
           <!--No attachment -->
            attachment_use="False"
            file="account.report_aangetekend"
        />

0
Avatar
Verwerfen
Diskutieren Sie gerne? Treten Sie bei, statt nur zu lesen!

Erstellen Sie heute ein Konto, um exklusive Funktionen zu nutzen und mit unserer tollen Community zu interagieren!

Registrieren
Verknüpfte Beiträge Antworten Ansichten Aktivität
How to create div in QWeb that is always at the bottom of the page? Gelöst
qweb reports odoo8.0
Avatar
Avatar
Avatar
Avatar
Avatar
14
Mai 22
48327
Background image gets cut off on the last page of a QWeb report (Odoo8) Gelöst
qweb reports odoo8.0
Avatar
1
Feb. 24
6044
Printing multiple reports in one method?
qweb printing reports buttons methods
Avatar
Avatar
Avatar
Avatar
Avatar
4
Nov. 22
12215
[SOLVED] Error to generate a qweb-pdf (odoo 8) Gelöst
pdf qweb reports wkhtmltopdf odoo8.0
Avatar
Avatar
1
März 15
13919
Directly printing to printer
printing reports
Avatar
Avatar
Avatar
2
Mai 25
3473
Community
  • Tutorials
  • Dokumentation
  • Forum
Open Source
  • Herunterladen
  • Github
  • Runbot
  • Übersetzungen
Dienstleistungen
  • Odoo.sh-Hosting
  • Support
  • Upgrade
  • Individuelle Entwicklungen
  • Bildung
  • Buchhalter finden
  • Partner finden
  • Partner werden
Über uns
  • Unsere Firma
  • Markenwerte
  • Kontakt
  • Karriere
  • Veranstaltungen
  • Podcast
  • Blog
  • Kunden
  • Rechtliches • Datenschutz
  • Sicherheit
الْعَرَبيّة 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 ist eine Suite von Open-Source-Betriebsanwendungen, die alle Bedürfnisse Ihres Unternehmens abdecken: CRM, E-Commerce, Buchhaltung, Lager, Kassensystem, Projektmanagement etc.

Das einzigartige Wertversprechen von Odoo ist, dass es gleichzeitig sehr einfach zu bedienen und voll integriert ist.

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