Skip to Content
Odoo Menu
  • Prisijungti
  • Išbandykite nemokamai
  • Programėlės
    Finansai
    • Apskaita
    • Pateikimas apmokėjimui
    • Sąnaudos
    • Skaičiuoklė (BI)
    • Dokumentai
    • Pasirašymas
    Pardavimai
    • CRM
    • Pardavimai
    • Kasų sistema - Parduotuvė
    • Kasų sistema - Restoranas
    • Prenumeratos
    • Nuoma
    Svetainės
    • Svetainių kūrėjimo įrankis
    • El. Prekyba
    • Internetinis Tinklaraštis
    • Forumas
    • Tiesioginis pokalbis
    • eMokymasis
    Tiekimo grandinė
    • Atsarga
    • Gamyba
    • PLM
    • Įsigijimai
    • Priežiūra
    • Kokybė
    Žmogaus ištekliai
    • Darbuotojai
    • Įdarbinimas
    • Atostogos
    • Įvertinimai
    • Rekomendacijos
    • Transporto priemonės
    Rinkodara
    • Socialinė rinkodara
    • Rinkodara el. paštu
    • SMS rinkodara
    • Renginiai
    • Rinkodaros automatizavimas
    • Apklausos
    Paslaugos
    • Projektas
    • Darbo laiko žiniaraščiai
    • Priežiūros tarnyba
    • Pagalbos tarnyba
    • Planavimas
    • Rezervacijos
    Produktyvumas
    • Diskucija
    • Patvirtinimai
    • IoT
    • VoIP
    • Žinių biblioteka
    • WhatsApp
    Trečiųjų šalių programos Odoo Studija Odoo debesijos platforma
  • Pramonės šakos
    Mažmeninė prekyba
    • Knygynas
    • Drabužių parduotuvė
    • Baldų parduotuvė
    • Maisto prekių parduotuvė
    • Techninės įrangos parduotuvė
    • Žaislų parduotuvė
    Food & Hospitality
    • Barai ir pub'ai
    • Restoranas
    • Greitasis maistas
    • Guest House
    • Gėrimų platintojas
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architektūros įmonė
    • Konstrukcija
    • Estate Managament
    • Sodininkauti
    • Turto savininkų asociacija
    Consulting
    • Accounting Firm
    • Odoo Partneris
    • Marketing Agency
    • Teisinė firma
    • Talentų paieška
    • Auditai & sertifikavimas
    Gamyba
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Įmonių dovanos
    Sveikata & Fitnesas
    • Sporto klubas
    • Akinių parduotuvė
    • Fitneso Centras
    • Sveikatos praktikai
    • Vaistinė
    • Kirpėjas
    Trades
    • Handyman
    • IT įranga ir palaikymas
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Aplinkos agentūra
    • Reklaminių stendų nuoma
    • Fotografavimas
    • Dviračių nuoma
    • Programinės įrangos perpardavėjas
    Browse all Industries
  • Bendrija
    Mokykitės
    • Mokomosios medžiagos
    • Dokumentacija
    • Sertifikatai
    • Mokymai
    • Internetinis Tinklaraštis
    • Tinklalaidės
    Skatinkite švietinimą
    • Švietimo programa
    • Scale Up! Verslo žaidimas
    • Aplankykite Odoo
    Gaukite programinę įrangą
    • Atsisiųsti
    • Palyginkite versijas
    • Leidimai
    Bendradarbiauti
    • Github
    • Forumas
    • Renginiai
    • Vertimai
    • Tapkite partneriu
    • Services for Partners
    • Registruokite jūsų apskaitos įmonę
    Gaukite paslaugas
    • Susiraskite partnerį
    • Susirask buhalterį
    • Susitikti su konsultantu
    • Diegimo paslaugos
    • Klientų rekomendavimas
    • Palaikymas
    • Atnaujinimai
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Gaukite demo
  • Kainodara
  • Pagalba

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

  • CRM
  • e-Commerce
  • Apskaita
  • Atsarga
  • PoS
  • Projektas
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
Pagalba

How to make downloading a pdf file

Prenumeruoti

Get notified when there's activity on this post

This question has been flagged
pdfdownload
2 Replies
15124 Rodiniai
Portretas
Matthieu

Hello,


I'm currently creating an Odoo 9 module and I've got a Class with a report_coupon function called by a button.

Here is my class :

class loyalty_coupon(models.Model):

    _name = 'loyalty.coupon'

    _columns = {

        'name': fields.char('Name', size=32, select=1, required=True, help='An internal identification for this loyalty coupon'),

       'loyalty_program_id': fields.many2one('loyalty.program', 'Loyalty Program', help='The Loyalty Program this coupon belongs to'),

       'reduction': fields.float('Reduction', help='The amount of reduction of this coupon in EUR'),

       'date': fields.date('Date Limit', help='The date limit of the coupon'),

       'limited': fields.boolean('Limited', help='The kind of coupon'),

       'used': fields.boolean('Used', help='The state of the coupon, used or not used'),

       'barcode': fields.char('Barcode', help="International Article Number used for coupon identification.", oldname='ean13', copy=False),

    }

    @api.one

    def report_coupon(self):

       _logger.info("IMPRESS")

I want this function to allow the user to download a pdf file generated (composed of attributes of the class).

How can I do this ? :)


Thank you in advance for your replies and help !



0
Portretas
Atmesti
Portretas
Emipro Technologies Pvt. Ltd.
Best Answer

Hi,

Please make one button inside your form. i.e. 

<button name="report_coupon"  type="object" string="Download PDF" />

According to the button defination you need to define one method inside your model with following lines of code. thats it.

@api.multi
def report_coupon(self):
return self.env['report'].get_action(self, 'modulename.xmlidofyourreport') #modulename.custom_report_coupon

  

Above line of code will give the option to download pdf report on clicking of that button.

Please try it in your module.


1
Portretas
Atmesti
Matthieu
Autorius

Well, thank you, it's better but i've got an error :

raise ValueError('External ID not found in the system: %s' % (xmlid))

ValueError: External ID not found in the system:

account.report_coupon

Emipro Technologies Pvt. Ltd.

I have updated my answer, you just need to give external ID of your report. thats it.

Matthieu
Autorius

Thank you ! Now, a new error appeared :

Bad Report ReferenceThis report is not loaded into the database: loyalty.report_coupon

Why is it still not working ? What's wrong ?

Portretas
Matthieu
Autorius Best Answer

Currently, I have the following reports and records in an XML file called "report.xml" :

<template id="report_coupon">

  <t t-call="report.external_layout">

   <div class="page">

    <div class="row">

     <h3>Title</h3>

    </div>

   </div>

  </t>

</template>

<template id="report_without_prices">

  <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.coupon')"/>

   </t>

  </t>

</template>

In my view, I have

<report

  id="custom_report_coupon"

  model="account.invoice"

 string="Coupons"

  report_type="qweb-pdf"

  name="account.report_coupon"

  attachment_use="False"

  file="account.report_coupon"

/>

So, my question is how to call this from a button and allow the user to download a pdf file of this view ?


Thanks in advance !

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

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

Registracija
Related Posts Replies Rodiniai Veikla
Configure a link to download a PDF file
pdf download Link
Portretas
0
geg. 24
2775
Download Pdf File On local Machine ?
pdf python download
Portretas
0
kov. 15
5282
Quote Builder With Custom Rental Report (Studio)
pdf
Portretas
0
spal. 25
461
Quote Builder With Custom Rental Report (Studio)
pdf
Portretas
0
spal. 25
4
How to edit the header of the quote template Solved
pdf
Portretas
Portretas
Portretas
2
rugp. 25
1223
Bendrija
  • Mokomosios medžiagos
  • Dokumentacija
  • Forumas
Atvirasis kodas
  • Atsisiųsti
  • Github
  • Runbot
  • Vertimai
Paslaugos
  • Odoo.sh talpinimas
  • Palaikymas
  • Atnaujinti
  • Pritaikytas programavimo kūrimas
  • Švietimas
  • Susirask buhalterį
  • Susiraskite partnerį
  • Tapkite partneriu
Apie mus
  • Mūsų įmonė
  • Prekės ženklo turtas
  • Susisiekite su mumis
  • Darbo pasiūlymai
  • Renginiai
  • Tinklalaidės
  • Internetinis Tinklaraštis
  • Klientai
  • Teisinis • Privatumas
  • Saugumas
الْعَرَبيّة 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 yra atvirojo kodo verslo programų rinkinys, kuris apima visas įmonės poreikius: CRM, El. Prekybą, Apskaitą, Atsargų, Kasų sistemą, Projektų valdymą ir kt.

Unikali Odoo vertės pasiūla – būti tuo pačiu metu labai lengvai naudojama ir visiškai integruota sistema.

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