Zum Inhalt springen
Odoo Menü
  • Anmelden
  • Jetzt gratis testen
  • Apps
    Finanzen
    • Buchhaltung
    • Rechnungsstellung
    • Spesenabrechnung
    • Tabellenkalkulation (BI)
    • Dokumente
    • E-Signatur
    Verkauf
    • CRM
    • Verkauf
    • Kassensystem – Shop
    • Kassensystem – Restaurant
    • Abonnements
    • Vermietung
    Websites
    • Website-Builder
    • E-Commerce
    • Blog
    • Forum
    • Livechat
    • E-Learning
    Lieferkette
    • Lager
    • Fertigung
    • PLM
    • Einkauf
    • Wartung
    • Qualität
    Personalwesen
    • Mitarbeiter
    • Personalbeschaffung
    • Abwesenheiten
    • Mitarbeiterbeurteilung
    • Personalempfehlungen
    • Fuhrpark
    Marketing
    • Social Marketing
    • E-Mail-Marketing
    • SMS-Marketing
    • Veranstaltungen
    • Marketing-Automatisierung
    • Umfragen
    Dienstleistungen
    • Projekte
    • Zeiterfassung
    • Außendienst
    • Kundendienst
    • Planung
    • Termine
    Produktivität
    • Dialog
    • Künstliche Intelligenz
    • IoT
    • VoIP
    • Wissensdatenbank
    • WhatsApp
    Apps von Drittanbietern Odoo Studio Odoo Cloud-Plattform
  • Branchen
    Einzelhandel
    • Buchladen
    • Kleidergeschäft
    • Möbelhaus
    • Lebensmittelgeschäft
    • Baumarkt
    • Spielwarengeschäft
    Essen & Gastgewerbe
    • Bar und Kneipe
    • Restaurant
    • Fast Food
    • Gästehaus
    • Getränkehändler
    • Hotel
    Immobilien
    • Immobilienagentur
    • Architekturbüro
    • Baugewerbe
    • Immobilienverwaltung
    • Gartenarbeit
    • Eigentümervereinigung
    Beratung
    • Buchhaltungsfirma
    • Odoo-Partner
    • Marketingagentur
    • Anwaltskanzlei
    • Talentakquise
    • Prüfung & Zertifizierung
    Fertigung
    • Textil
    • Metall
    • Möbel
    • Speisen
    • Brauerei
    • Firmengeschenke
    Gesundheit & Fitness
    • Sportklub
    • Brillengeschäft
    • Fitnessstudio
    • Therapeut
    • Apotheke
    • Friseursalon
    Handel
    • Handyman
    • IT-Hardware & -Support
    • Solarenergiesysteme
    • Schuster
    • Reinigungsdienstleistungen
    • HLK-Dienstleistungen
    Sonstiges
    • Gemeinnützige Organisation
    • Umweltschutzagentur
    • Plakatwandvermietung
    • Fotostudio
    • Fahrrad-Leasing
    • Software-Händler
    Alle Branchen ansehen
  • Community
    Lernen
    • Tutorials
    • Dokumentation
    • Zertifizierungen
    • Schulung
    • Blog
    • Podcast
    Bildung fördern
    • Bildungsprogramm
    • Scale-Up! Planspiel
    • Odoo besuchen
    Software anfragen
    • Herunterladen
    • Editionen vergleichen
    • Releases
    Zusammenarbeiten
    • Github
    • Forum
    • Veranstaltungen
    • Übersetzungen
    • Partner werden
    • Dienstleistungen für Partner
    • Buchhaltungsfirma registrieren
    Services anfragen
    • Partner finden
    • Buchhalter finden
    • Einen Experten treffen
    • Implementierungsservices
    • Kundenreferenzen
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Eine Demo erhalten
  • Preise
  • Hilfe
Sie müssen registriert sein, um mit der Community zu interagieren.
Alle Beiträge Personen Abzeichen
Stichwörter (Alle anzeigen)
odoo accounting v14 pos v15
Über dieses Forum
Sie müssen registriert sein, um mit der Community zu interagieren.
Alle Beiträge Personen Abzeichen
Stichwörter (Alle anzeigen)
odoo accounting v14 pos v15
Über dieses Forum
Hilfe

I am customizing the POS receipt in Odoo 19.

Abonnieren

Erhalten Sie eine Benachrichtigung, wenn es eine Aktivität zu diesem Beitrag gibt

Diese Frage wurde gekennzeichnet
javascriptpos
1 Antworten
1161 Ansichten
Avatar
Ashilkrishna

I am customizing the POS receipt in Odoo 19.

I want to add a savings/congratulations message at the bottom of the receipt like:

Congrats! You saved 70 on this purchase

The savings amount should be calculated as:

(MRP - List Price) × Quantity

Example:

  • Product 1:
    MRP = 150
    List Price = 100
    Qty = 1
    Savings = 50
  • Product 2:
    MRP = 60
    List Price = 50
    Qty = 2
    Savings = 20

Total savings = 70

I tried patching Orderline and now I am trying to extend OrderReceipt, but I am not sure how to properly access all receipt order lines and display the computed total in the QWeb receipt template.

What is the best approach to implement this in Odoo POS receipt?

Thanks in advance.

my code-

from odoo import api, models

class ProductProduct(models.Model):
_inherit = 'product.product'

@api.depends('name', 'mrp')
def _compute_display_name(self):
for product in self:
mrp = product.mrp or ''
name = product.name or ''
if mrp:
product.display_name = f"[{mrp}] {name}"
else:
product.display_name = name

def _load_pos_data_fields(self, config_id):
fields = super()._load_pos_data_fields(config_id)

fields.append('mrp')

return fields
/** @odoo-module **/

import { patch } from "@web/core/utils/patch";
import { OrderReceipt } from "@point_of_sale/app/screens/receipt_screen/receipt/order_receipt";

patch(OrderReceipt.prototype, {

get totalSavedAmount() {
const order = this.props.data;
let totalSaved = 0;

order.orderlines.forEach(line => {

const mrp = line.product_id?.mrp || 0;
const listPrice = line.product_id?.lst_price || 0;
const qty = line.qty || 1;

const diff = (mrp - listPrice) * qty;

totalSaved += diff;
});

return totalSaved;
},

});
/** @odoo-module **/

import { patch } from "@web/core/utils/patch";
import { Orderline } from "@point_of_sale/app/components/orderline/orderline";

patch(Orderline.prototype, {
get lineScreenValues() {
const res = super.lineScreenValues;
const line = this.line;

if (line?.order_id && this.props?.mode === "receipt" && line.price !== 0) {

const mrp = line.product_id?.mrp || 0;
const listPrice = line.product_id?.lst_price || 0;
const uomName = line.product_id?.uom_id?.name || "unit";

res.displayPriceUnit = `MRP: ${mrp} @ ${listPrice}/${uomName}`;
}

return res;
},
});
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<t t-name="odoometer_price_extn.OrderReceipt"
t-inherit="point_of_sale.OrderReceipt"
t-inherit-mode="extension">

<xpath expr="//div[contains(@class,'pos-receipt-order-data')]" position="after">

<t t-if="totalSavedAmount > 0">
<div style="text-align:center; margin-top:10px; font-weight:bold;">
Congrats! You saved
<t t-esc="totalSavedAmount"/>
on this purchase
</div>
</t>

</xpath>

</t>
</odoo>
0
Avatar
Verwerfen
Codesphere Tech

Hello,
I'll let you know.

Codesphere Tech

The code sent to your email. Please check.

Avatar
Sandeep Paulraj R
Beste Antwort

Your approach is close, but the main issue is that in the receipt screen this.props.data.orderlines contains the exported receipt data, not the full POS order line objects. Therefore, line.product_id?.mrp and line.product_id?.lst_price are usually not available in the receipt payload.

A more reliable approach is to add the computed savings value to the receipt data itself and then display it in the receipt template.

For example, patch the Order model:

/** @odoo-module **/

import { patch } from "@web/core/utils/patch";
import { Order } from "@point_of_sale/app/store/models";

patch(Order.prototype, {
    export_for_printing() {
        const result = super.export_for_printing(...arguments);

        let totalSaved = 0;

        this.get_orderlines().forEach((line) => {
            const product = line.get_product();
            const mrp = product.mrp || 0;
            const listPrice = product.lst_price || 0;

            totalSaved += (mrp - listPrice) * line.get_quantity();
        });

        result.total_saved_amount = totalSaved;

        return result;
    },
});

Then use the value directly in the receipt template:

<t t-if="props.data.total_saved_amount > 0">
    <div style="text-align:center; margin-top:10px; font-weight:bold;">
        Congrats! You saved
        <t t-esc="props.data.total_saved_amount"/>
        on this purchase
    </div>
</t>

Also verify that the mrp field is actually loaded into the POS frontend. You can check this in the browser console:

order.get_orderlines()[0].get_product().mrp

If it returns undefined, the field is not being loaded correctly into the POS product data, and the savings calculation will always be zero.

This approach keeps the calculation in the Order model, makes the value available to the receipt payload, and avoids relying on receipt line data that may not contain the full product information.

0
Avatar
Verwerfen
Diskutieren Sie gerne? Treten Sie bei, statt nur zu lesen!

Erstellen Sie heute ein Konto, um exklusive Funktionen zu nutzen und mit unserer tollen Community zu interagieren!

Registrieren
Verknüpfte Beiträge Antworten Ansichten Aktivität
Odoo 19 POS Pay Later – Need Review of Custom Implementation
javascript pos
Avatar
Avatar
Avatar
2
Juni 26
1190
Can anyone correct my code-iam coustmizing odoo 19 defualt pos reciept Gelöst
javascript pos
Avatar
Avatar
1
Mai 26
1472
Odoo 19 POS Receipt Customization – Remove Default Unit Price and Show Custom MRP Line
javascript pos
Avatar
1
Mai 26
1221
does odoo 17 allow to add button to Navbar header in point of sale session inside it to get dynamic data
javascript pos
Avatar
Avatar
1
Nov. 24
3785
How to add product in POS programmatically Gelöst
javascript pos
Avatar
Avatar
Avatar
Avatar
4
Okt. 24
7266
Community
  • Tutorials
  • Dokumentation
  • Forum
Open Source
  • Herunterladen
  • Github
  • Runbot
  • Übersetzungen
Dienstleistungen
  • Odoo.sh-Hosting
  • Support
  • Upgrade
  • Individuelle Entwicklungen
  • Bildung
  • Buchhalter finden
  • Partner finden
  • Partner werden
Über uns
  • Unsere Firma
  • Markenwerte
  • Kontakt
  • Karriere
  • Veranstaltungen
  • Podcast
  • Blog
  • Kunden
  • Rechtliches • Datenschutz
  • Sicherheit
الْعَرَبيّة 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 Svenska ภาษาไทย Türkçe українська Tiếng Việt

Odoo ist eine Suite von Open-Source-Betriebsanwendungen, die alle Bedürfnisse Ihres Unternehmens abdecken: CRM, E-Commerce, Buchhaltung, Lager, Kassensystem, Projektmanagement etc.

Das einzigartige Wertversprechen von Odoo ist, dass es gleichzeitig sehr einfach zu bedienen und voll integriert ist.

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