تخطي للذهاب إلى المحتوى
أودو القائمة
  • تسجيل الدخول
  • جرب مجاناً
  • التطبيقات
    المالية
    • المحاسبة
    • فوترة
    • النفقات
    • جدول البيانات (BI)
    • المستندات
    • توقيع إلكتروني
    المبيعات
    • إدارة علاقات العملاء
    • المبيعات
    • نقطة البيع للمتاجر
    • نقطة البيع للمطاعم
    • الاشتراكات
    • تأجير
    المواقع الإلكترونية
    • أداة بناء المواقع الإلكترونية
    • متاجر إلكترونية
    • مدونة
    • المنتدى
    • دردشة مباشرة
    • التعليم الإلكتروني
    سلسلة التوريد
    • المستودعات
    • التصنيع
    • إدارة دورة حياة المنتج
    • المشتريات
    • الصيانة
    • الجودة
    الموارد البشرية
    • موظفون
    • التوظيف
    • إجازة عمل
    • التقييمات
    • الإحالات
    • تطبيق الأسطول
    التسويق
    • التسويق الإجتماعي
    • التسويق عبر البريد الإلكتروني
    • التسويق عبر الرسائل النصية
    • فعاليات
    • أتمتة التسويق
    • الاستطلاعات
    الخدمات
    • المشاريع
    • الجداول الزمنية
    • الخدمة الميدانية
    • مكتب المساعدة
    • التخطيط
    • مواعيد
    اﻹنتاجية
    • مناقشة
    • الموافقات
    • إنترنت الأشياء "IoT"
    • بروتوكول ربط المحادثات الصوتية عبر الإنترنت
    • المعرفة
    • WhatsApp
    التطبيقات الخارجية ستوديو أودو منصة أودو السحابية
  • قطاعات الأعمال
    البيع بالتجزئة
    • متجر كتب
    • متجر ملابس
    • متجر أثاث
    • متجر بقالة
    • متجر معدات
    • متجر ألعاب
    الطعام والضيافة
    • بار وحانة
    • المطعم
    • مطعم للوجبات السريعة
    • نزل للضيوف
    • موزّع مشروبات
    • فندق
    العقارات
    • وكالة عقارات
    • شركة هندسة معمارية
    • البناء
    • إدارة العقارات
    • العناية بالحدائق
    • اتحاد مُلاّك العقارات
    استشارة
    • مؤسسة محاسبية
    • شريك أودو
    • وكالة تسويقية
    • منشأة قانونية
    • استقطاب المواهب
    • التدقيق والتوثيق
    التصنيع
    • الأقمشة
    • معدني
    • الأثاث
    • الطعام
    • مصنع خمور
    • هدايا الشركات
    الصحة واللياقة البدنية
    • نادي رياضي
    • متجر نظارات
    • مركز لياقة بدنية
    • الممارسون الصحيون
    • صيدلية
    • صالون تصفيف الشعر
    التجارة
    • عامل صيانة
    • الأجهزة والمعدات التقنية ودعمها
    • أنظمة الطاقة الشمسية
    • صانع أحذية
    • خدمات التنظيف
    • خدمات التكييف (HVAC)
    غير ذلك
    • منظمة غير ربحية
    • وكالة بيئية
    • تأجير لوحات إعلانية
    • تصوير
    • تأجير دراجات
    • بائع وسيط للبرمجيات
    تصفح كافة قطاعات الأعمال
  • مجتمع أودو
    تعلم
    • دروس
    • التوثيق
    • شهادات
    • التدريب
    • مدونة
    • بودكاست
    قم بتعزيز التعليم
    • برنامج تعليم
    • Scale UP! لعبة الأعمال
    • قم بزيارة أودو
    احصل على البرنامج
    • تحميل
    • قارنْ الإصدارات
    • إطلاق
    تعاون
    • جيت هاب "Github"
    • المنتدى
    • فعاليات
    • الترجمات
    • كنْ شريكاً
    • خدمات الشركاء
    • سجل مكتب المحاسبة الخاص بك
    احصل على الخدمات
    • اعثر على شريك
    • اعثر على محاسب
    • قابل أحد مرشدي الأعمال
    • خدمات التنفيذ
    • مراجع العملاء
    • الدعم
    • الترقيات
    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
يجب أن تكون مسجلاً حتى تتفاعل مع المجتمع.
كافة المنشورات الأفراد الشارات
علامات التصنيف (عرض الكل)
odoo accounting v14 pos v15
حول هذا المنتدى
يجب أن تكون مسجلاً حتى تتفاعل مع المجتمع.
كافة المنشورات الأفراد الشارات
علامات التصنيف (عرض الكل)
odoo accounting v14 pos v15
حول هذا المنتدى
المساعدة

How to set global discount to fixed amount on POS

اشتراك

تسلم الإشعارات عندما يكون هناك نشاط في هذا المنشور

لقد تم الإبلاغ عن هذا السؤال
posdiscount
2 الردود
3814 أدوات العرض
الصورة الرمزية
Fadil Kd

Hello,

I am working on Odoo 17e and I want to change the global discount to a fixed amount instead of percentage. How can I achieve that via custom module? Which functions should I target?

Any help is appreciated.

Thanks,

0
الصورة الرمزية
إهمال
الصورة الرمزية
Waleed Ali Mohsen
أفضل إجابة

Hi,

You need to change the js in the below file:

odoo/addons/pos_discount/static/src/overrides/components/discount_button/discount_button.js at 17.0 · odoo/odoo (github.com)

1
الصورة الرمزية
إهمال
الصورة الرمزية
Nikolay B Petrov
أفضل إجابة

Thank to @Waleen for pointing me in the right direction. The line to edit in that file is #27. This is only if you want to change the discount to apply as a fixed amount.

Here's a modification of the same file that first gives you a selection popup to choose whether you want a fixed or % discount, then you enter the discount amount

(sorry, code formatting is not applying properly so you'll have to copy-paste in your IDE and format)


/** @odoo-module **/

import { _t } from "@web/core/l10n/translation";import { ProductScreen } from "@point_of_sale/app/screens/product_screen/product_screen";import { useService } from "@web/core/utils/hooks";import { NumberPopup } from "@point_of_sale/app/utils/input_popups/number_popup";import { ErrorPopup } from "@point_of_sale/app/errors/popups/error_popup";import { SelectionPopup } from "@point_of_sale/app/utils/input_popups/selection_popup"; // Assuming SelectionPopup exists or create a similar componentimport { Component } from "@odoo/owl";import { usePos } from "@point_of_sale/app/store/pos_hook";import { parseFloat } from "@web/views/fields/parsers";

export class DiscountButton extends Component {    static template = "pos_discount.DiscountButton";

    setup() {        this.pos = usePos();        this.popup = useService("popup");    }

    async click() {        // First, ask the user to choose discount type        const { confirmed: typeConfirmed, payload: discountType } = await this.popup.add(SelectionPopup, {            title: _t("Discount Type"),            list: [                { id: 1, label: _t("Percentage"), item: "percentage", isSelected: true },                { id: 2, label: _t("Fixed Amount"), item: "fixed" },            ],            isInputSelected: true,        });        if (!typeConfirmed) return;

        // Ask for discount value based on the chosen type        const { confirmed, payload } = await this.popup.add(NumberPopup, {            title: discountType === "percentage" ? _t("Discount Percentage") : _t("Discount Amount"),            startingValue: this.pos.config.discount_pc || 0,            isInputSelected: true,        });        if (confirmed) {            const val = parseFloat(payload);            await this.apply_discount(val, discountType);        }    }

    async apply_discount(value, discountType) {        const order = this.pos.get_order();        const lines = order.get_orderlines();        const product = this.pos.db.get_product_by_id(this.pos.config.discount_product_id[0]);

        if (product === undefined) {            await this.popup.add(ErrorPopup, {                title: _t("No discount product found"),                body: _t(                    "The discount product seems misconfigured. Make sure it is flagged as 'Can be Sold' and 'Available in Point of Sale'."                ),            });            return;        }

        // Remove existing discounts        lines            .filter((line) => line.get_product() === product)            .forEach((line) => order._unlinkOrderline(line));

        // Add one discount line per tax group        const linesByTax = order.get_orderlines_grouped_by_tax_ids();        for (const [tax_ids, lines] of Object.entries(linesByTax)) {            const tax_ids_array = tax_ids                .split(",")                .filter((id) => id !== "")                .map((id) => Number(id));

            const baseToDiscount = order.calculate_base_amount(                tax_ids_array,                lines.filter((ll) => ll.isGlobalDiscountApplicable())            );

            // Calculate discount based on type            let discount = 0;            if (discountType === "percentage") {                discount = (-value / 100.0) * baseToDiscount;            } else if (discountType === "fixed") {                discount = -value;            }

            if (discount < 0) {                order.add_product(product, {                    price: discount,                    lst_price: discount,                    tax_ids: tax_ids_array,                    merge: false,                    description:                        `${discountType === "percentage" ? value + "%" : this.pos.currency.symbol + value}, ` +                        (tax_ids_array.length                            ? _t(                                  "Tax: %s",                                  tax_ids_array                                      .map((taxId) => this.pos.taxes_by_id[taxId].amount + "%")                                      .join(", ")                              )                            : _t("No tax")),                    extras: {                        price_type: "automatic",                    },                });            }        }    }}

ProductScreen.addControlButton({    component: DiscountButton,    condition: function () {        const { module_pos_discount, discount_product_id } = this.pos.config;        return module_pos_discount && discount_product_id;    },});


1
الصورة الرمزية
إهمال
هل أعجبك النقاش؟ لا تكن مستمعاً فقط. شاركنا!

أنشئ حساباً اليوم لتستمتع بالخصائص الحصرية، وتفاعل مع مجتمعنا الرائع!

تسجيل
المنشورات ذات الصلة الردود أدوات العرض النشاط
POS Loyalty Promotion Reapplies Discount on Same Product — Cannot Reward Unique Lines
pos discount
الصورة الرمزية
الصورة الرمزية
1
مايو 25
1655
Give discount according to the product count
pos discount
الصورة الرمزية
الصورة الرمزية
الصورة الرمزية
2
أكتوبر 16
3634
How to enter discount manually in POS?
pos discount
الصورة الرمزية
الصورة الرمزية
1
مارس 15
5437
Buy 1 Get 1 Promotion in odoo 17.0 POS
pos discount buy1-get1
الصورة الرمزية
الصورة الرمزية
1
أغسطس 25
1578
Discount for first purchase at POS
pos discount Point Of Sale
الصورة الرمزية
الصورة الرمزية
1
يونيو 25
1572
المجتمع
  • دروس
  • التوثيق
  • المنتدى
مصدر مفتوح
  • تحميل
  • جيت هاب "Github"
  • المشغل الآلي رنبوت
  • الترجمات
خدماتنا
  • استضافة أودو إس إتش
  • الدعم
  • الترقية
  • التطويرات المخصصة
  • التعليم
  • اعثر على محاسب
  • اعثر على شريك
  • كنْ شريكاً
معلومات عنا
  • شركتنا
  • أصول العلامة التجارية
  • اتصلْ بنا
  • الوظائف
  • فعاليات
  • بودكاست
  • مدونة
  • عملاء
  • قانوني • الخصوصية
  • الحماية
الْعَرَبيّة 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

أودو هو عبارة عن مجموعة من تطبيقات الأعمال مفتوحة المصدر التي تغطي جميع احتياجات شركتك، مثل: إدارة علاقات العملاء والتجارة الإلكترونية والمحاسبة والمخزون ونقاط البيع وإدارة المشاريع وما إلى ذلك.

ما يجعل من أودو مميزاً هو هدفه بأن يكون سهل الاستخدام للغاية ومتكاملاً تمامًا في الوقت ذاته.

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