Ir al contenido
Odoo Menú
  • Identificarse
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • TPV para tiendas
    • TPV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en directo
    • e-learning
    Cadena de suministro
    • Inventario
    • Fabricación
    • PLM
    • Compra
    • Mantenimiento
    • Calidad
    Recursos Humanos
    • Empleados
    • Reclutamiento
    • Ausencias
    • Evaluación
    • Referencias
    • Flota
    Marketing
    • Marketing social
    • Marketing por correo electrónico
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyecto
    • Partes de horas
    • Servicio de campo
    • Servicio de asistencia
    • Planificación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Conocimientos
    • WhatsApp
    Aplicaciones de terceros Studio de Odoo Plataforma de Odoo Cloud
  • Industrias
    Comercio al por menor
    • Librería
    • Tienda de ropa
    • Tienda de muebles
    • Tienda de ultramarinos
    • Ferretería
    • Juguetería
    Alimentación y hostelería
    • Bar y taberna
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidor de bebidas
    • Hotel
    Inmueble
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión inmobiliaria
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Empresa contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Fabricación
    • Textil
    • Metal
    • Muebles
    • Alimentos
    • Brewery
    • Regalos de empresas
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Terapeutas
    • Farmacia
    • Peluquería
    Oficios
    • Handyman
    • Hardware y asistencia informática
    • Sistemas de energía solar
    • Zapatero
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin ánimo de lucro
    • Agencia de protección del medio ambiente
    • Alquiler de paneles publicitarios
    • Estudio fotográfico
    • Alquiler de bicicletas
    • Distribuidor de software
    Explorar todos los sectores
  • Comunidad
    Aprender
    • Tutoriales
    • Documentación
    • Certificaciones
    • Formación
    • Blog
    • Podcast
    Potenciar la educación
    • Programa de formación
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtener el software
    • Descargar
    • Comparar ediciones
    • Versiones
    Colaborar
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Convertirse en partner
    • Servicios para partners
    • Registrar tu empresa contable
    Obtener servicios
    • Encontrar un partner
    • Encontrar un asesor fiscal
    • Contacta con un experto
    • Servicios de implementación
    • Referencias de clientes
    • Ayuda
    • Actualizaciones
    GitHub YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicitar una demostración
  • Precios
  • Ayuda

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

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyecto
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

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

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
qwebodoo
2 Respuestas
8268 Vistas
Avatar
rmc zeyneb

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

0
Avatar
Descartar
Avatar
Niyas Raphy (Walnut Software Solutions)
Mejor respuesta

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
Descartar
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Mejor respuesta

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
Descartar
¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Inscribirse
Publicaciones relacionadas Respuestas Vistas Actividad
Header hides body information in qweb report[SOLVED] Resuelto
qweb odoo
Avatar
Avatar
1
jun 23
5486
How to get the URL of the PDF report (qweb report)
qweb odoo
Avatar
Avatar
1
abr 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) Resuelto
qweb odoo
Avatar
Avatar
1
oct 21
13006
how to print n products per page in qweb odoo?
qweb odoo
Avatar
0
oct 21
2478
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento Odoo.sh
  • Ayuda
  • Actualizar
  • Desarrollos personalizados
  • Educación
  • Encontrar un asesor fiscal
  • Encontrar un partner
  • Convertirse en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contacta con nosotros
  • Puestos de trabajo
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Información legal • Privacidad
  • Seguridad
الْعَرَبيّة 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 es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y totalmente integrado.

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