Skip to Content
Odoo मेन्यू
  • Sign in
  • मुफ़्त में आज़माएं
  • ऐप्लिकेशन
    फ़ाइनेंस
    • अकाउंटिंग
    • इनवॉइसिंग
    • एक्सपेंस
    • स्प्रेडशीट (बीआई)
    • डॉक्यूमेंट्स
    • साइन
    सेल्स
    • सीआरएम
    • सेल्स
    • पीओएस शॉप
    • पीओएस रेस्टोरेंट
    • सब्सक्रिप्शन
    • रेंटल
    वेबसाइट
    • वेबसाइट बिल्डर
    • ई-कॉमर्स
    • ब्लॉग
    • फ़ोरम
    • लाइव चैट
    • ई-लर्निंग
    सप्लाई चेन
    • इन्वेंट्री
    • मैन्युफ़ैक्चरिंग
    • पीएलएम
    • परचेज़
    • मेंटेनेंस
    • क्वालिटी
    मानव संसाधन
    • कर्मचारी
    • रिक्रूटमेंट
    • टाइम ऑफ़
    • अप्रेज़ल
    • रेफ़रल
    • फ़्लीट
    मार्केटिंग
    • सोशल मार्केटिंग
    • ईमेल मार्केटिंग
    • एसएमएस मार्केटिंग
    • इवेंट
    • मार्केटिंग ऑटोमेशन
    • सर्वे
    सेवाएं
    • प्रोजेक्ट
    • टाइमशीट
    • फ़ील्ड सर्विस
    • हेल्पडेस्क
    • प्लानिंग
    • अपॉइंटमेंट
    प्रॉडक्टिविटी
    • डिस्कस
    • अप्रूवल
    • आईओटी
    • वीओआईपी
    • नॉलेज
    • WhatsApp
    तीसरे पक्ष के ऐप्लिकेशन Odoo स्टूडियो Odoo क्लाउड प्लेटफ़ॉर्म
  • इंडस्ट्री
    रीटेल
    • बुक स्टोर
    • क्लोदिंग स्टोर
    • फ़र्नीचर स्टोर
    • ग्रॉसरी स्टोर
    • हार्डवेयर स्टोर
    • टॉय स्टोर
    Food & Hospitality
    • बार और पब
    • रेस्टोरेंट
    • फ़ास्ट फ़ूड
    • Guest House
    • बेवरिज डिस्ट्रीब्यूटर
    • होटल
    रियल एस्टेट
    • Real Estate Agency
    • आर्किटेक्चर फ़र्म
    • कंसट्रक्शन
    • एस्टेट मैनेजमेंट
    • गार्ड्निंग
    • प्रॉपर्टी ओनर असोसिएशन
    कंसल्टिंग
    • अकाउंटिंग फ़र्म
    • Odoo पार्टनर
    • मार्केटिंग एजेंसी
    • लॉ फ़र्म
    • टैलेंट ऐक्विज़िशन
    • ऑडिट & सर्टिफ़िकेशन
    मैन्युफ़ैक्चरिंग
    • टेक्सटाइल
    • Metal
    • फ़र्नीचर
    • फ़ूड
    • Brewery
    • कॉर्पोरेट गिफ़्ट
    हेल्थ & फिटनेस
    • स्पोर्ट्स क्लब
    • आईवियर स्टोर
    • फिटनेस सेंटर
    • वेलनेस प्रैक्टिशनर
    • फॉर्मेसी
    • हेयर सैलून
    Trades
    • Handyman
    • आईटी हॉर्डवेयर और सपोर्ट
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    अन्य
    • Nonprofit Organization
    • एन्वायरमेंटल एजेंसी
    • बिलबोर्ड रेंटल
    • फ़ोटोग्राफी
    • बाइक लीजिंग
    • सॉफ़्टवेयर रीसेलर
    Browse all Industries
  • कम्यूनिटी
    सीखें
    • ट्यूटोरियल्स
    • दस्तावेज़
    • सर्टिफ़िकेशन
    • ट्रेनिंग
    • ब्लॉग
    • पॉडकास्ट
    शिक्षा को बढ़ावा दें
    • एजुकेशन प्रोग्राम
    • स्केल अप! बिजनेस गेम
    • Odoo के ऑफ़िस में आएं
    सॉफ़्टवेयर पाएं
    • डाउनलोड
    • वर्शन की तुलना करें
    • रिलीज़
    साथ मिलकर काम करें
    • Github
    • फ़ोरम
    • इवेंट
    • अनुवाद
    • पार्टनर बनें
    • Services for Partners
    • अपना अकाउंटिंग फ़र्म रजिस्टर करें
    सेवाएं पाएं
    • पार्टनर ढूंढें
    • अकाउंटेंट खोजें
    • सलाहकार की मदद लें
    • इम्प्लिमेंटेशन सेवाएं
    • कस्टमर रेफ़रेंस
    • सहायता
    • अपग्रेड
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    डेमो देखें
  • कीमत
  • सहायता

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

  • सीआरएम
  • e-Commerce
  • लेखांकन
  • इन्वेंटरी
  • PoS
  • प्रोजेक्ट
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
टैग (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
टैग (View all)
odoo accounting v14 pos v15
About this forum
Help

Change Text Color of Discount Price

Subscribe

Get notified when there's activity on this post

This question has been flagged
odoo.shv17
1 Reply
1641 Views
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
Discard
Christoph Farnleitner

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

Sean Westfield
Author

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
Author

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
Author

@ 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
Best Answer

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
Discard
Enjoying the discussion? Don't just read, join in!

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

Sign up
Related Posts Replies Views Activity
Discount Free Gift Solved
odoo.sh v17
Avatar
Avatar
Avatar
Avatar
4
अग॰ 25
2062
Add fee to sales order based on cart total
odoo.sh v17
Avatar
Avatar
2
सित॰ 25
1251
Variant Purchase Price Solved
odoo.sh v17
Avatar
Avatar
1
जून 25
2305
Required attribue Solved
odoo.sh v17
Avatar
Avatar
1
अग॰ 25
5711
Pricelists
odoo.sh v17
Avatar
Avatar
Avatar
2
मई 25
1903
कम्यूनिटी
  • ट्यूटोरियल्स
  • दस्तावेज़
  • फ़ोरम
ओपन सोर्स
  • डाउनलोड
  • Github
  • रनबॉट
  • अनुवाद
सेवाएं
  • Odoo.sh Hosting
  • सहायता
  • अपग्रेड
  • कस्टम डेवलपमेंट्स
  • शिक्षा
  • अकाउंटेंट खोजें
  • पार्टनर ढूंढें
  • पार्टनर बनें
हमारे बारे में
  • हमारी कंपनी
  • ब्रांड ऐसेट
  • संपर्क करें
  • नौकरियां
  • इवेंट
  • पॉडकास्ट
  • ब्लॉग
  • ग्राहक
  • लीगल • गोपनीयता
  • सुरक्षा
الْعَرَبيّة 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, बिज़नेस से जुड़े ऐप्लिकेशन का एक कलेक्शन है जो ओपन सोर्स पर आधारित है. इसमें आपकी कंपनी की हर ज़रूरत के लिए ऐप्लिकेशन हैं. जैसे, सीआरएम, ई-कॉमर्स, अकाउंटिंग, इन्वेंट्री, पॉइंट ऑफ़ सेल, प्रोजेक्ट मैनेजमेंट वगैरह.

Odoo की सबसे बड़ी खासियत है कि यह इस्तेमाल करने में बहुत आसान है और यह पूरी तरह से इंटिग्रेट किया हुआ है.

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