Ir al contenido
Odoo Menú
  • Iniciar sesión
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • PdV para tiendas
    • PdV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en vivo
    • eLearning
    Cadena de suministro
    • Inventario
    • Manufactura
    • PLM
    • Compras
    • Mantenimiento
    • Calidad
    Recursos humanos
    • Empleados
    • Reclutamiento
    • Vacaciones
    • Evaluaciones
    • Referencias
    • Flotilla
    Marketing
    • Redes sociales
    • Marketing por correo
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyectos
    • Registro de horas
    • Servicio externo
    • Soporte al cliente
    • Planeación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Artículos
    • WhatsApp
    Aplicaciones externas Studio de Odoo Plataforma de Odoo en la nube
  • Industrias
    Venta minorista
    • Librería
    • Tienda de ropa
    • Mueblería
    • Tienda de abarrotes
    • Ferretería
    • Juguetería
    Alimentos y hospitalidad
    • Bar y pub
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidora de bebidas
    • Hotel
    Bienes inmuebles
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión de bienes inmuebles
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Firma contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Manufactura
    • Textil
    • Metal
    • Muebles
    • Comida
    • Cervecería
    • Regalos corporativos
    Salud y ejercicio
    • Club deportivo
    • Óptica
    • Gimnasio
    • Especialistas en bienestar
    • Farmacia
    • Peluquería
    Trades
    • Personal de mantenimiento
    • Hardware y soporte de TI
    • Sistemas de energía solar
    • Zapateros y fabricantes de calzado
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin fines de lucro
    • Agencia para la protección del medio ambiente
    • Alquiler de anuncios publicitarios
    • Fotografía
    • Alquiler de bicicletas
    • Distribuidor de software
    Descubre todas las industrias
  • Odoo Community
    Aprende
    • Tutoriales
    • Documentación
    • Certificaciones
    • Capacitación
    • Blog
    • Podcast
    Fortalece la educación
    • Programa educativo
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtén el software
    • Descargar
    • Compara ediciones
    • Versiones
    Colabora
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Conviértete en partner
    • Servicios para partners
    • Registra tu firma contable
    Obtén servicios
    • Encuentra un partner
    • Encuentra un contador
    • Contacta a un consultor
    • Servicios de implementación
    • Referencias de clientes
    • Soporte
    • Actualizaciones
    GitHub YouTube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicita 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
  • Proyectos
  • 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

Qweb Report background-image

Suscribirse

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

Se marcó esta pregunta
qwebreportsbackground
1 Responder
4562 Vistas
Avatar
Mahmoud Tarek

I have an image field in a model that inherit from res_company with upload button, and I have a report that already print all company's data. 

For this report I have a background-image for a div as inlinin  style. 

My question: How to add this image from database as a "url" for background-image, thanks. 

*I can provide you with the code if you are interested to solve it.


0
Avatar
Descartar
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Mejor respuesta

Hi,

For that first, we need to set the fields for images, also we can set the colors, or style as per our needs,

In the py:


from odoo import api, fields, models


class ResCompany(models.Model):
"""Introduce watermark in pdf reports"""
_inherit = 'res.company'

watermark = fields.Boolean(string='Watermark', help='Enable it, while you '
'want to apply '
'watermark on your '
'pdf reports'
)
content_text = fields.Char(string='Text', help="Have the text here")
watermark_type = fields.Selection([
('image', 'Image'),
('text', 'Text'),
('logo', 'Logo'),
], default='text', help='Select the watermark type')
color_picker = fields.Char(string='Color Picker', help='Select the Color')
font_size = fields.Integer(string='Font size', default=30,
help="Mention the font size")
background_image = fields.Image(string='Image', help='Select the image')
rotating_angle = fields.Float(string='Angle of Rotation',
help='Mention the angle of rotation')

Then set the View, we need to define the XML file 

<?xml version="1.0" encoding="utf-8"?>

<!--Apply the watermark to the pdf report with mentioned specifications-->

<odoo>

<template id="pdf_watermark_report"

inherit_id="web.external_layout_standard">

<xpath expr="//div[hasclass('row')][last()]" position="after">

<t t-if="company.watermark">

<center>

<div class="row"

style="opacity:0.15; font-size:100px;text-align:center;top:500px;position:fixed;z-index:99;">

<div class="col-6" name="watermark">

<span

t-attf-style="-webkit-transform:rotate(-{{company.rotating_angle}}deg);color:{{company.color_picker}};font-size:{{company.font_size}}px;text-align:center;position:absolute;text-align:center;opacity:0.9;align:center;width:880px;">

<t t-if="company.watermark_type == 'text'">

<t t-esc="company.content_text"/>

</t>

<span style="width:880px;align:center;">

<t t-if="company.watermark_type == 'image'">

<img t-if="company.background_image"

t-att-src="image_data_uri(company.background_image)"

width="250" height="200"

/>

</t>

<t t-if="company.watermark_type == 'logo'">

<img t-if="company.logo"

t-att-src="image_data_uri(company.logo)"

width="250" height="200"/>

</t>

</span>

</span>

</div>

</div>

</center>

</t>

</xpath>

</template>

</odoo>

Hope it helps

1
Avatar
Descartar
Eauzon

Kudos for this!

Very nice solution !

¿Le interesa esta conversación? ¡Participe en ella!

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

Registrarse
Publicaciones relacionadas Respuestas Vistas Actividad
How to Change TABLE Format in QWEB reports? With different table Border and Color.? Resuelto
qweb reports
Avatar
Avatar
Avatar
Avatar
Avatar
4
ene 25
46147
QWEB Report template has inconsistent row heights (see screenshot)
qweb reports
Avatar
0
oct 24
2307
Qweb reports inconsistent table row height
qweb reports
Avatar
0
oct 24
5
images in report does not load
qweb reports
Avatar
Avatar
1
may 23
3925
How to resolve text overlap of table header on qweb report? Resuelto
qweb reports
Avatar
Avatar
Avatar
Avatar
Avatar
5
may 21
12555
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento en Odoo.sh
  • Soporte
  • Actualizaciones del software
  • Desarrollos personalizados
  • Educación
  • Encuentra un contador
  • Encuentra un partner
  • Conviértete en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contáctanos
  • Empleos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • 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 estar 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