Skip to Content
Odoo Menu
  • Prihlásiť sa
  • Vyskúšajte zadarmo
  • Aplikácie
    Financie
    • Účtovníctvo
    • Fakturácia
    • Výdavky
    • Tabuľka (BI)
    • Dokumenty
    • Podpis
    Predaj
    • CRM
    • Predaj
    • POS Shop
    • POS Restaurant
    • Manažment odberu
    • Požičovňa
    Webstránky
    • Tvorca webstránok
    • eShop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Supply Chain
    • Sklad
    • Výroba
    • Správa životného cyklu produktu
    • Nákup
    • Údržba
    • Manažment kvality
    Ľudské zdroje
    • Zamestnanci
    • Nábor zamestnancov
    • Voľné dni
    • Hodnotenia
    • Odporúčania
    • Vozový park
    Marketing
    • Marketing sociálnych sietí
    • Email marketing
    • SMS marketing
    • Eventy
    • Marketingová automatizácia
    • Prieskumy
    Služby
    • Projektové riadenie
    • Pracovné výkazy
    • Práca v teréne
    • Helpdesk
    • Plánovanie
    • Schôdzky
    Produktivita
    • Tímová komunikácia
    • Schvalovania
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Priemyselné odvetvia
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Reštaurácia
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Reality
    • Real Estate Agency
    • Architecture Firm
    • Konštrukcia
    • Estate Managament
    • Gardening
    • Property Owner Association
    Poradenstvo
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Jedlo
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Iní
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Komunita
    Vzdelávanie
    • Tutoriály
    • Dokumentácia
    • Certifikácie
    • Školenie
    • Blog
    • Podcast
    Empower Education
    • Vzdelávací program
    • Scale Up! Business Game
    • Visit Odoo
    Softvér
    • Stiahnuť
    • Porovnanie Community a Enterprise vierzie
    • Releases
    Spolupráca
    • Github
    • Fórum
    • Eventy
    • Preklady
    • Staň sa partnerom
    • Services for Partners
    • Register your Accounting Firm
    Služby
    • Nájdite partnera
    • Nájdite účtovníka
    • Meet an advisor
    • Implementation Services
    • Zákaznícke referencie
    • Podpora
    • Upgrades
    ​Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Získajte demo
  • Cenník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účtovníctvo
  • Sklady
  • PoS
  • Projektové riadenie
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
Pomoc

How to get the URL of the PDF report (qweb report)

Odoberať

Get notified when there's activity on this post

This question has been flagged
qwebodoo
2 Replies
8266 Zobrazenia
Avatar
rmc zeyneb

How to get the URL of the PDF report (qweb report), for example C:/Users/h/Downloads/test.pdf

0
Avatar
Zrušiť
Avatar
Niyas Raphy (Walnut Software Solutions)
Best Answer

Hi,

If your report is linked directly with a record, like for example sale order print, you can access it as follows:

http://your_domain_or_ip/report/pdf/sale.report_saleorder/38  where 38 is the ID of the sale.order


Reports are web pages

Reports are dynamically generated by the report module and can be accessed directly via URL:

For example, you can access a Sale Order report in html mode by going to http://your_domain_or_ip/report/html/sale.report_saleorder/38

Or you can access the pdf version at http:///report/pdf/sale.report_saleorder/38

Documentation:  https://www.odoo.com/documentation/15.0/developer/reference/backend/reports.html


Thanks

0
Avatar
Zrušiť
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Best Answer

Hi,
Refer to this code

pdf = request.env.ref('account.account_invoices').sudo().render_qweb_pdf([res.id])[0]
base_url = request.env['ir.config_parameter'].sudo().get_param('web.base.url')
attachment = request.env['ir.attachment'].sudo().create({
'name': res.name + ".pdf",
'type': 'binary',
'res_id': res.id,
'res_model': 'account.move',
'datas': base64.b64encode(pdf),
'mimetype': 'application/x-pdf'
})
url = '%s/web/invoice.pdf?model=ir.attachment&id=%s&name=inv.pdf&field=datas' % (
base_url, attachment.id
)

class BinaryAttachment(http.Controller):
""" taking url of attachment from ir.attachment"""

@http.route('/web/invoice.pdf', type='http', auth="none")
def image_get(self, xmlid=None, model='ir.attachment', id=None,
field='datas', filename_field='name', unique=None,
filename=None, mimetype=None, download=None, width=0,
height=0, crop=False, access_token=None, **kwargs):
return self._content_image(xmlid=xmlid, model=model,
id=id, field=field, unique=unique,
filename_field=filename_field, crop=crop,
filename=filename, mimetype=mimetype,
download=download, width=width,
height=height, access_token=access_token,
quality=int(kwargs.get('quality', 0)))

def _content_image(self, xmlid=None, model='ir.attachment', id=None,
field='datas', filename_field='name', unique=None,
filename=None, mimetype=None, download=None, width=0,
height=0, crop=False, quality=0, access_token=None,
placeholder='placeholder.png', **kwargs):
status, headers, image_base64 = request.env['ir.http'].with_user(
1).binary_content(
xmlid=xmlid, model=model, id=id, field=field, unique=unique,
filename=filename, filename_field=filename_field,
download=download, mimetype=mimetype, default_mimetype='image/png',
access_token=access_token)

if status in [301, 304] or (status != 200 and download):
return request.env['ir.http']._response_by_status(status, headers,
image_base64)
if not image_base64:
image_base64 = base64.b64encode(
self.placeholder(image=placeholder))
if not (width or height):
width, height = odoo.tools.image_guess_size_from_field_name(
field)
image_base64 = image_process(image_base64, size=(int(width),
int(height)),
crop=crop, quality=int(quality))
content = base64.b64decode(image_base64)
headers = http.set_safe_image_headers(headers, content)
response = request.make_response(content, headers)
response.status_code = status
return response


Hope it helps

0
Avatar
Zrušiť
Enjoying the discussion? Don't just read, join in!

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

Registrácia
Related Posts Replies Zobrazenia Aktivita
Header hides body information in qweb report[SOLVED] Solved
qweb odoo
Avatar
Avatar
1
jún 23
5485
How to get the URL of the PDF report (qweb report)
qweb odoo
Avatar
Avatar
1
apr 23
6185
ValueError: time data 'November 17, 2022 06:03' does not match format '%Y-%m-%d %H:%M:%S
qweb odoo
Avatar
Avatar
1
nov 22
4699
How to use qweb directives in form or tree view (Odoo) Solved
qweb odoo
Avatar
Avatar
1
okt 21
13006
how to print n products per page in qweb odoo?
qweb odoo
Avatar
0
okt 21
2477
Komunita
  • Tutoriály
  • Dokumentácia
  • Fórum
Open Source
  • Stiahnuť
  • Github
  • Runbot
  • Preklady
Služby
  • Odoo.sh hosting
  • Podpora
  • Vyššia verzia
  • Custom Developments
  • Vzdelávanie
  • Nájdite účtovníka
  • Nájdite partnera
  • Staň sa partnerom
O nás
  • Naša spoločnosť
  • Majetok značky
  • Kontaktujte nás
  • Pracovné ponuky
  • Eventy
  • Podcast
  • Blog
  • Zákazníci
  • Právne dokumenty • Súkromie
  • Bezpečnosť
الْعَرَبيّة 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 sada podnikových aplikácií s otvoreným zdrojovým kódom, ktoré pokrývajú všetky potreby vašej spoločnosti: CRM, e-shop, účtovníctvo, skladové hospodárstvo, miesto predaja, projektový manažment atď.

Odoo prináša vysokú pridanú hodnotu v jednoduchom použití a súčasne plne integrovanými biznis aplikáciami.

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