diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index 6e1eadcd86f..dd051cb3b13 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -2434,16 +2434,16 @@ export class Orderline extends PosModel { return this.get_base_price(); } } - get_taxed_lst_unit_price() { - var lst_price = this.get_lst_price(); + get_taxed_lst_unit_price(){ + var base_price = this.compute_fixed_price(this.get_base_price()); if (this.pos.config.iface_tax_included === "total") { var product = this.get_product(); var taxes_ids = product.taxes_id; var product_taxes = this.pos.get_taxes_after_fp(taxes_ids); - return this.compute_all(product_taxes, lst_price, 1, this.pos.currency.rounding) + return this.compute_all(product_taxes, base_price, 1, this.pos.currency.rounding) .total_included; } - return lst_price; + return base_price; } get_price_without_tax() { return this.get_all_prices().priceWithoutTax; 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 74c84f0302a..61eb14b6496 100644 --- a/addons/point_of_sale/static/tests/tours/ProductScreen.tour.js +++ b/addons/point_of_sale/static/tests/tours/ProductScreen.tour.js @@ -136,6 +136,17 @@ registry.category("web_tour.tours").add("ProductScreenTour", { test: true, url: startSteps(); +ProductScreen.do.clickHomeCategory(); +ProductScreen.do.clickDisplayedProduct('Test Product'); +ProductScreen.check.totalAmountIs('100.00'); +ProductScreen.do.changeFiscalPosition('No Tax'); +ProductScreen.check.noDiscountApplied("100.00"); +ProductScreen.check.totalAmountIs('86.96'); + +registry.category("web_tour.tours").add("FiscalPositionNoTax", { test: true, url: "/pos/ui", steps: getSteps() }); + +startSteps(); + ProductScreen.do.enterOpeningAmount('90'); ProductScreen.do.confirmOpeningPopup(); ProductScreen.check.checkSecondCashClosingDetailsLineAmount('10.00', '-'); diff --git a/addons/point_of_sale/static/tests/tours/helpers/ProductScreenTourMethods.js b/addons/point_of_sale/static/tests/tours/helpers/ProductScreenTourMethods.js index d19a65e1e4a..3b81a3ff3cd 100644 --- a/addons/point_of_sale/static/tests/tours/helpers/ProductScreenTourMethods.js +++ b/addons/point_of_sale/static/tests/tours/helpers/ProductScreenTourMethods.js @@ -151,6 +151,18 @@ class Do { }, ]; } + changeFiscalPosition(name) { + return [ + { + content: 'click fiscal position button', + trigger: '.o_fiscal_position_button', + }, + { + content: 'fiscal position screen is shown', + trigger: `.selection-item:contains("${name}")`, + }, + ]; + } } class Check { @@ -262,6 +274,14 @@ class Check { }, ]; } + noDiscountApplied(originalPrice) { + return [ + { + content: 'no discount is applied', + trigger: `.info:not(:contains(${originalPrice}))`, + }, + ]; + } } class Execute { diff --git a/addons/point_of_sale/tests/test_frontend.py b/addons/point_of_sale/tests/test_frontend.py index d7e40ca0b27..f6ca0805c99 100644 --- a/addons/point_of_sale/tests/test_frontend.py +++ b/addons/point_of_sale/tests/test_frontend.py @@ -689,3 +689,44 @@ class TestUi(TestPointOfSaleHttpCommon): pos_session = self.main_pos_config.current_session_id self.assertEqual(len(pos_session.statement_line_ids), 1) self.assertEqual(pos_session.statement_line_ids[0].amount, -10) + + def test_fiscal_position_no_tax(self): + #create a tax of 15% with price included + tax = self.env['account.tax'].create({ + 'name': 'Tax 15%', + 'amount': 15, + 'price_include': True, + 'amount_type': 'percent', + 'type_tax_use': 'sale', + }) + + #create a product with the tax + self.product = self.env['product.product'].create({ + 'name': 'Test Product', + 'taxes_id': [(6, 0, [tax.id])], + 'list_price': 100, + 'available_in_pos': True, + }) + + #create a fiscal position that map the tax to no tax + fiscal_position = self.env['account.fiscal.position'].create({ + 'name': 'No Tax', + 'tax_ids': [(0, 0, { + 'tax_src_id': tax.id, + 'tax_dest_id': False, + })], + }) + + pricelist = self.env['product.pricelist'].create({ + 'name': 'Test Pricelist', + 'discount_policy': 'without_discount', + }) + + self.main_pos_config.write({ + 'tax_regime_selection': True, + 'fiscal_position_ids': [(6, 0, [fiscal_position.id])], + 'available_pricelist_ids': [(6, 0, [pricelist.id])], + 'pricelist_id': pricelist.id, + }) + self.main_pos_config.open_ui() + self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'FiscalPositionNoTax', login="accountman")