[FIX] point_of_sale: stop showing changes of fiscal position as discount
Current behavior: When a fiscal position was applied in the PoS, it was considered as a discount and was shown in the receipt and on the product screen. Steps to reproduce: - Create a product with a price of 10€ with 15% tax included in the price - Create a fiscal position that map the 15% tax to 0% tax - Open a PoS session - Add the product to the order - Apply the fiscal position - The price of the product is now 8.70€ but the order show it as a discount of 1.30€ (e.g 10€ -> 8.70€). opw-3154499 closes odoo/odoo#116918 X-original-commit: d054e7dd2474fad49dab63bf4b2aef09f57780c8 Signed-off-by: Trinh Jacky (trj) <trj@odoo.com> Signed-off-by: Engels Robin (roen) <roen@odoo.com>
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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', '-');
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user