Skip ke Konten
Odoo Menu
  • Login
  • Uji coba gratis
  • Aplikasi
    Keuangan
    • Akuntansi
    • Faktur
    • Pengeluaran
    • Spreadsheet (BI)
    • Dokumen
    • Tanda Tangan
    Sales
    • CRM
    • Sales
    • POS Toko
    • POS Restoran
    • Langganan
    • Rental
    Website
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Rantai Pasokan
    • Inventaris
    • Manufaktur
    • PLM
    • Purchase
    • Maintenance
    • Kualitas
    Sumber Daya Manusia
    • Karyawan
    • Rekrutmen
    • Cuti
    • Appraisal
    • Referensi
    • Armada
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Acara
    • Otomatisasi Marketing
    • Survei
    Layanan
    • Project
    • Timesheet
    • Layanan Lapangan
    • Meja Bantuan
    • Planning
    • Appointment
    Produktivitas
    • Diskusi
    • Approval
    • IoT
    • VoIP
    • Pengetahuan
    • WhatsApp
    Aplikasi pihak ketiga Odoo Studio Platform Odoo Cloud
  • Industri-Industri
    Retail
    • Toko Buku
    • Toko Baju
    • Toko Furnitur
    • Toko Kelontong
    • Toko Hardware
    • Toko Mainan
    Makanan & Hospitality
    • Bar dan Pub
    • Restoran
    • Fast Food
    • Rumah Tamu
    • Distributor Minuman
    • Hotel
    Real Estate
    • Agensi Real Estate
    • Firma Arsitektur
    • Konstruksi
    • Estate Management
    • Perkebunan
    • Asosiasi Pemilik Properti
    Konsultansi
    • Firma Akuntansi
    • Mitra Odoo
    • Agensi Marketing
    • Firma huku
    • Talent Acquisition
    • Audit & Sertifikasi
    Manufaktur
    • Tekstil
    • Logam
    • Perabotan
    • Makanan
    • Brewery
    • Corporate Gift
    Kesehatan & Fitness
    • Sports Club
    • Toko Kacamata
    • Fitness Center
    • Wellness Practitioners
    • Farmasi
    • Salon Rambut
    Perdagangan
    • Handyman
    • IT Hardware & Support
    • Sistem-Sistem Energi Surya
    • Pembuat Sepatu
    • Cleaning Service
    • Layanan HVAC
    Lainnya
    • Organisasi Nirlaba
    • Agen Lingkungan
    • Rental Billboard
    • Fotografi
    • Penyewaan Sepeda
    • Reseller Software
    Browse semua Industri
  • Komunitas
    Belajar
    • Tutorial-tutorial
    • Dokumentasi
    • Sertifikasi
    • Pelatihan
    • Blog
    • Podcast
    Empower Education
    • Program Edukasi
    • Game Bisnis 'Scale Up!'
    • Kunjungi Odoo
    Dapatkan Softwarenya
    • Download
    • Bandingkan Edisi
    • Daftar Rilis
    Kolaborasi
    • Github
    • Forum
    • Acara
    • Terjemahan
    • Menjadi Partner
    • Layanan untuk Partner
    • Daftarkan perusahaan Akuntansi Anda.
    Dapatkan Layanan
    • Temukan Mitra
    • Temukan Akuntan
    • Temui penasihat
    • Layanan Implementasi
    • Referensi Pelanggan
    • Bantuan
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dapatkan demo
  • Harga
  • Bantuan

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

  • CRM
  • e-Commerce
  • Akuntansi
  • Inventaris
  • PoS
  • Project
  • MRP
All apps
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Help

Change Text Color of Discount Price

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
odoo.shv17
1 Balas
1622 Tampilan
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
Buang
Christoph Farnleitner

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

Sean Westfield
Penulis

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
Penulis

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
Penulis

@ 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
Jawaban Terbai

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
Buang
Menikmati diskusi? Jangan hanya membaca, ikuti!

Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!

Daftar
Post Terkait Replies Tampilan Aktivitas
Discount Free Gift Diselesaikan
odoo.sh v17
Avatar
Avatar
Avatar
Avatar
4
Agu 25
2051
Add fee to sales order based on cart total
odoo.sh v17
Avatar
Avatar
2
Sep 25
1241
Variant Purchase Price Diselesaikan
odoo.sh v17
Avatar
Avatar
1
Jun 25
2296
Required attribue Diselesaikan
odoo.sh v17
Avatar
Avatar
1
Agu 25
5707
Pricelists
odoo.sh v17
Avatar
Avatar
Avatar
2
Mei 25
1893
Komunitas
  • Tutorial-tutorial
  • Dokumentasi
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Terjemahan
Layanan
  • Odoo.sh Hosting
  • Bantuan
  • Peningkatan
  • Custom Development
  • Pendidikan
  • Temukan Akuntan
  • Temukan Mitra
  • Menjadi Partner
Tentang Kami
  • Perusahaan kami
  • Aset Merek
  • Hubungi kami
  • Tugas
  • Acara
  • Podcast
  • Blog
  • Pelanggan
  • Hukum • Privasi
  • Keamanan
الْعَرَبيّة 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 adalah rangkaian aplikasi bisnis open source yang mencakup semua kebutuhan perusahaan Anda: CRM, eCommerce, akuntansi, inventaris, point of sale, manajemen project, dan seterusnya.

Mudah digunakan dan terintegrasi penuh pada saat yang sama adalah value proposition unik 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