Skip to Content
Odoo Menu
  • Zaloguj się
  • Wypróbuj za darmo
  • Aplikacje
    Finanse
    • Księgowość
    • Fakturowanie
    • Wydatki
    • Arkusz kalkulacyjny (BI)
    • Dokumenty
    • Podpisy
    Sprzedaż
    • CRM
    • Sprzedaż
    • PoS Sklep
    • PoS Restauracja
    • Subskrypcje
    • Wypożyczalnia
    Strony Internetowe
    • Kreator Stron Internetowych
    • eCommerce
    • Blog
    • Forum
    • Czat na Żywo
    • eLearning
    Łańcuch dostaw
    • Magazyn
    • Produkcja
    • PLM
    • Zakupy
    • Konserwacja
    • Jakość
    Zasoby Ludzkie
    • Pracownicy
    • Rekrutacja
    • Urlopy
    • Ocena pracy
    • Polecenia Pracownicze
    • Flota
    Marketing
    • Marketing Społecznościowy
    • E-mail Marketing
    • SMS Marketing
    • Wydarzenia
    • Automatyzacja Marketingu
    • Ankiety
    Usługi
    • Projekt
    • Ewidencja czasu pracy
    • Usługi Terenowe
    • Helpdesk
    • Planowanie
    • Spotkania
    Produktywność
    • Dyskusje
    • Zatwierdzenia
    • IoT
    • VoIP
    • Baza wiedzy
    • WhatsApp
    Aplikacje trzecich stron Studio Odoo Odoo Cloud Platform
  • Branże
    Sprzedaż detaliczna
    • Księgarnia
    • Sklep odzieżowy
    • Sklep meblowy
    • Sklep spożywczy
    • Sklep z narzędziami
    • Sklep z zabawkami
    Żywienie i hotelarstwo
    • Bar i Pub
    • Restauracja
    • Fast Food
    • Pensjonat
    • Dystrybutor napojów
    • Hotel
    Agencja nieruchomości
    • Agencja nieruchomości
    • Biuro architektoniczne
    • Budowa
    • Zarządzanie nieruchomościami
    • Ogrodnictwo
    • Stowarzyszenie właścicieli nieruchomości
    Doradztwo
    • Biuro księgowe
    • Partner Odoo
    • Agencja marketingowa
    • Kancelaria prawna
    • Agencja rekrutacyjna
    • Audyt i certyfikacja
    Produkcja
    • Tekstylia
    • Metal
    • Meble
    • Jedzenie
    • Browar
    • Prezenty firmowe
    Zdrowie & Fitness
    • Klub sportowy
    • Salon optyczny
    • Centrum fitness
    • Praktycy Wellness
    • Apteka
    • Salon fryzjerski
    Transakcje
    • Złota rączka
    • Wsparcie Sprzętu IT
    • Systemy energii słonecznej
    • Szewc
    • Firma sprzątająca
    • Usługi HVAC
    Inne
    • Organizacja non-profit
    • Agencja Środowiskowa
    • Wynajem billboardów
    • Fotografia
    • Leasing rowerów
    • Sprzedawca oprogramowania
    Przeglądaj wszystkie branże
  • Community
    Ucz się
    • Samouczki
    • Dokumentacja
    • Certyfikacje
    • Szkolenie
    • Blog
    • Podcast
    Pomóż w nauce innym
    • Program Edukacyjny
    • Scale Up! Gra biznesowa
    • Odwiedź Odoo
    Skorzystaj z oprogramowania
    • Pobierz
    • Porównaj edycje
    • Wydania
    Współpracuj
    • Github
    • Forum
    • Wydarzenia
    • Tłumaczenia
    • Zostań partnerem
    • Usługi dla partnerów
    • Zarejestruj swoją firmę rachunkową
    Skorzystaj z usług
    • Znajdź partnera
    • Znajdź księgowego
    • Spotkaj się z doradcą
    • Usługi wdrożenia
    • Opinie klientów
    • Wsparcie
    • Aktualizacje
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Zaplanuj demo
  • Cennik
  • Pomoc

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

  • CRM
  • e-Commerce
  • Księgowość
  • Zapasy
  • PoS
  • Projekt
  • MRP
All apps
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Pomoc

Change Text Color of Discount Price

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
odoo.shv17
1 Odpowiedz
1631 Widoki
Awatar
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
Awatar
Odrzuć
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>
Awatar
Piyush H
Najlepsza odpowiedź

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
Awatar
Odrzuć
Podoba Ci się ta dyskusja? Dołącz do niej!

Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!

Zarejestruj się
Powiązane posty Odpowiedzi Widoki Czynność
Discount Free Gift Rozwiązane
odoo.sh v17
Awatar
Awatar
Awatar
Awatar
4
sie 25
2057
Add fee to sales order based on cart total
odoo.sh v17
Awatar
Awatar
2
wrz 25
1245
Variant Purchase Price Rozwiązane
odoo.sh v17
Awatar
Awatar
1
cze 25
2302
Required attribue Rozwiązane
odoo.sh v17
Awatar
Awatar
1
sie 25
5710
Pricelists
odoo.sh v17
Awatar
Awatar
Awatar
2
maj 25
1901
Społeczność
  • Samouczki
  • Dokumentacja
  • Forum
Open Source
  • Pobierz
  • Github
  • Runbot
  • Tłumaczenia
Usługi
  • Hosting Odoo.sh
  • Wsparcie
  • Aktualizacja
  • Indywidualne rozwiązania
  • Edukacja
  • Znajdź księgowego
  • Znajdź partnera
  • Zostań partnerem
O nas
  • Nasza firma
  • Zasoby marki
  • Skontaktuj się z nami
  • Oferty pracy
  • Wydarzenia
  • Podcast
  • Blog
  • Klienci
  • Informacje prawne • Prywatność
  • Bezpieczeństwo Odoo
الْعَرَبيّة 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 to pakiet aplikacji biznesowych typu open source, które zaspokoją wszystkie potrzeby Twojej firmy: CRM, eCommerce, księgowość, inwentaryzacja, punkt sprzedaży, zarządzanie projektami itp.

Unikalną wartością Odoo jest to, że jest jednocześnie bardzo łatwe w użyciu i w pełni zintegrowane.

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