diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index 61a6d9646fc..171602d1cf5 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -2199,7 +2199,7 @@ export class Orderline extends PosModel { discount: this.get_discount(), product_name: this.get_product().display_name, product_name_wrapped: this.generate_wrapped_product_name(), - price_lst: this.get_lst_price(), + price_lst: this.get_taxed_lst_unit_price(), fixed_lst_price: this.get_fixed_lst_price(), price_manually_set: this.price_manually_set, price_automatically_set: this.price_automatically_set, @@ -2311,7 +2311,8 @@ export class Orderline extends PosModel { return this.compute_all(product_taxes, lst_price, 1, this.pos.currency.rounding) .total_included; } - return lst_price; + var digits = this.pos.dp['Product Price']; + return lst_price.toFixed(digits) } get_price_without_tax() { return this.get_all_prices().priceWithoutTax; @@ -3387,6 +3388,13 @@ export class Order extends PosModel { _get_ignored_product_ids_total_discount() { return []; } + _reduce_total_discount_callback(sum, orderLine) { + sum += (orderLine.get_unit_price() * (orderLine.get_discount()/100) * orderLine.get_quantity()); + if (orderLine.display_discount_policy() === 'without_discount'){ + sum += ((orderLine.get_taxed_lst_unit_price() - orderLine.get_unit_price()) * orderLine.get_quantity()); + } + return sum; + } get_total_discount() { const ignored_product_ids = this._get_ignored_product_ids_total_discount(); return round_pr( diff --git a/addons/point_of_sale/static/tests/tours/ProductScreen.tour.js b/addons/point_of_sale/static/tests/tours/ProductScreen.tour.js index 61eb14b6496..8120e754224 100644 --- a/addons/point_of_sale/static/tests/tours/ProductScreen.tour.js +++ b/addons/point_of_sale/static/tests/tours/ProductScreen.tour.js @@ -1,6 +1,8 @@ /** @odoo-module */ +import { PaymentScreen } from "@point_of_sale/../tests/tours/helpers/PaymentScreenTourMethods"; import { ProductScreen } from "@point_of_sale/../tests/tours/helpers/ProductScreenTourMethods"; +import { ReceiptScreen } from "@point_of_sale/../tests/tours/helpers/ReceiptScreenTourMethods"; import { TextAreaPopup } from "@point_of_sale/../tests/tours/helpers/TextAreaPopupTourMethods"; import { getSteps, startSteps } from "@point_of_sale/../tests/tours/helpers/utils"; import { registry } from "@web/core/registry"; @@ -142,6 +144,12 @@ ProductScreen.check.totalAmountIs('100.00'); ProductScreen.do.changeFiscalPosition('No Tax'); ProductScreen.check.noDiscountApplied("100.00"); ProductScreen.check.totalAmountIs('86.96'); +ProductScreen.do.clickPayButton(); +PaymentScreen.do.clickPaymentMethod('Bank'); +PaymentScreen.check.remainingIs('0.00'); +PaymentScreen.do.clickValidate(); +ReceiptScreen.check.isShown(); +ReceiptScreen.check.noOrderlineContainsDiscount(); registry.category("web_tour.tours").add("FiscalPositionNoTax", { test: true, url: "/pos/ui", steps: getSteps() }); diff --git a/addons/point_of_sale/static/tests/tours/helpers/ReceiptScreenTourMethods.js b/addons/point_of_sale/static/tests/tours/helpers/ReceiptScreenTourMethods.js index 5706e431067..8ef9acf9542 100644 --- a/addons/point_of_sale/static/tests/tours/helpers/ReceiptScreenTourMethods.js +++ b/addons/point_of_sale/static/tests/tours/helpers/ReceiptScreenTourMethods.js @@ -90,6 +90,15 @@ class Check { }, ]; } + + noOrderlineContainsDiscount() { + return [ + { + trigger: `.orderlines:not(:contains('->'))`, + run: () => { }, + }, + ]; + } } class Execute {