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

Change Text Color of Discount Price

Suscribirse

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

Se marcó esta pregunta
odoo.shv17
1 Responder
1565 Vistas
Avatar
Sean Westfield

I need to change the color of the text shown on the website for the discounted price.

There are 2 values to select for pricelists; with_discount and without_discount. I have a feeling that the styling is set with wherever those are defined.


I am looking for direction as to where the color is defined.

0
Avatar
Descartar
Christoph Farnleitner

This is quite unspecific. Did you check the DOM to see what classes are applied on discounted prices?

Sean Westfield
Autor

I cannot find the DOM for the discounted price. I see the retail, but not the discount.

Christoph Farnleitner

You should add some more description of what you want to achieve, screens could be helpful as well - not sure what with_discount and without_discount means.

Sean Westfield
Autor

Those are the names of the models that are selected in the pricelist configuration. One shows the crossed out retail price as well as the discounted price while the other just shows the discounted price.

What I am trying to do is have the discounted price a color other than black.

Christoph Farnleitner

There's no way to do this by applying just a style via CSS. You would need to modify the template (or, but that's not advisable for this requirement, apply JavaScript) in order to make the HTML node aware about (=> apply a CSS class based on whether it is discounted) that it should look differently in this scenario. This is because the current structure of the product page renders a 'normal price' (=> un-discounted and no discount is to be applied) the same way as a discounted price. All Odoo does is to show/hide the un-discounted price (when a discount is applied) in addition. So, CSS only would always end you up in changing the font in both cases: discounted price and un-discounted price (if no discount is applied).

Sean Westfield
Autor

@ Piyush H

I wish it were that easy. Below is the code that calls the pricing from the product template when the pricelist is configured to show the crossed out retail price. There is no code (that I can find) that shows the discount price when the pricelist is configured to show the discount price only

<div><t t-call="website_sale.product_price"/>
    <small t-if="combination_info['base_unit_price']" class="ms-1 text-muted o_base_unit_price_wrapper d-none" groups="website_sale.group_show_uom_price">
  <t t-call="website_sale.base_unit_price"/>
     </small>
</div>
Avatar
Piyush H
Mejor respuesta

Hey Sean,

Okay, you want to change the text color of the discounted price displayed on your Odoo website. You've correctly identified that the styling is likely tied to the "with_discount" and "without_discount" price list values. Here's how to find and modify the CSS that controls the color:

1. Inspect the Element in Your Browser:

  • Go to your website: Navigate to a product page where the discounted price is displayed.
  • Open Developer Tools: Right-click on the discounted price text and select "Inspect" (or "Inspect Element"). This will open your browser's developer tools.
  • Identify the CSS Class: In the developer tools, look at the HTML code surrounding the discounted price. You should see a CSS class applied to the element (e.g., <span class="oe_price_discount">...</span> or something similar). Write down this CSS class name.

2. Find the CSS Definition in Odoo:

There are a few places where the CSS might be defined:

  • Website Theme (Most Likely):
    • Activate Developer Mode: Make sure you're in developer mode in Odoo.
    • Go to Website: Go to your website in Odoo.
    • Edit Theme: Click "Edit" in the top right corner to enter edit mode. Then, click "Theme" in the top right corner.
    • Customize > CSS: Look for a "Customize" or "CSS" option in the theme editor. This will allow you to add custom CSS rules.
  • QWeb Template (Less Likely, but Possible):
    • The styling might be directly embedded in the QWeb template that renders the product price. This is less common, but it's worth checking.
    • Go to Technical > User Interface > Views: In Odoo, go to Settings > Technical > User Interface > Views.
    • Search for Product Template: Search for views related to "product template" or "website product".
    • Examine the Code: Look for the QWeb template that renders the price. See if there's any inline styling that sets the color.
  • Base CSS Files (Least Likely):
    • The styling could be defined in one of Odoo's base CSS files, but this is less likely because it would affect all discounted prices throughout the system.

3. Modify the CSS:

  • If the CSS is in the Theme:
    • Add a new CSS rule to your theme's custom CSS section. Use the CSS class name you identified in Step 1. For example:
      .oe_price_discount {  /* Replace with the actual class name */
          color: red !important; /* Change "red" to your desired color */
      }
      
      • !important: The !important flag is often necessary to override existing CSS rules.
  • If the CSS is in a QWeb Template:
    • Modify the QWeb template directly. Add a style attribute to the element containing the discounted price. For example:
      <span t-esc="product.price" style="color: red;"></span>  <!-- Change "red" to your desired color -->
      

Important Notes:

  • Clear Cache: After making any CSS changes, you must clear Odoo's cache. Go to Settings > Technical > Actions > Reload Server Registry. Or, restart the Odoo service.
  • Specificity: CSS rules are applied based on their specificity. If your changes aren't taking effect, it might be because another CSS rule is more specific. Use the developer tools to inspect the element and see which CSS rules are being applied.
  • Theme Updates: If you're modifying a theme directly, be aware that your changes might be overwritten when you update the theme. It's best to create a custom theme or use the theme's custom CSS section to avoid this.

Example Scenario:

Let's say you inspect the element and find that the discounted price has the CSS class product_discounted_price. You would then add the following CSS to your theme's custom CSS section:

.product_discounted_price {
    color: green !important;
}

This would change the text color of all discounted prices on your website to green.

🚀 Did This Solve Your Problem?

If this answer helped you save time, money, or frustration, consider:

✅ Upvoting (👍) to help others find it faster

✅ Marking as "Best Answer" if it resolved your issue

Your feedback keeps the Odoo community strong! 💪

(Need further customization? Drop a comment—I’m happy to refine the solution!)

-3
Avatar
Descartar
¿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
Discount Free Gift Resuelto
odoo.sh v17
Avatar
Avatar
Avatar
Avatar
4
ago 25
1970
Add fee to sales order based on cart total
odoo.sh v17
Avatar
Avatar
2
sept 25
1183
Variant Purchase Price Resuelto
odoo.sh v17
Avatar
Avatar
1
jun 25
2242
Required attribue Resuelto
odoo.sh v17
Avatar
Avatar
1
ago 25
5660
Pricelists
odoo.sh v17
Avatar
Avatar
Avatar
2
may 25
1854
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