[FIX] point_of_sale: pos sale reprot total now include taxes correctly
Current behavior: If you make a sale of a product that use a taxe not included in the price. Then go in order analysis in PoS, the total price of the product will not include the taxes. Steps to reproduce: - Create a tax of 15% that is not included in price - Create a product with 10$ price and add this tax to it. (Total price including tax should be 11.5$) - Sell it in the PoS and close the session - Go in PoS > Reporting > Order. Open the pivot view and check the total price for the product - The total is 10$ instad of 11.5$ opw-3817535 closes odoo/odoo#163239 X-original-commit: 42fd6a65c8910bff587b6bc55d49e1bafb165487 Signed-off-by: Vlad Stroia (vlst) <vlst@odoo.com> Signed-off-by: Robin Engels (roen) <roen@odoo.com>
This commit is contained in:
@@ -45,7 +45,7 @@ class PosOrderReport(models.Model):
|
||||
s.date_order AS date,
|
||||
SUM(l.qty) AS product_qty,
|
||||
SUM(l.qty * l.price_unit / CASE COALESCE(s.currency_rate, 0) WHEN 0 THEN 1.0 ELSE s.currency_rate END) AS price_sub_total,
|
||||
SUM(ROUND((l.qty * l.price_unit) * (100 - l.discount) / 100 / CASE COALESCE(s.currency_rate, 0) WHEN 0 THEN 1.0 ELSE s.currency_rate END, cu.decimal_places)) AS price_total,
|
||||
SUM(ROUND((l.price_subtotal_incl) * (100 - l.discount) / 100 / CASE COALESCE(s.currency_rate, 0) WHEN 0 THEN 1.0 ELSE s.currency_rate END, cu.decimal_places)) AS price_total,
|
||||
SUM((l.qty * l.price_unit) * (l.discount / 100) / CASE COALESCE(s.currency_rate, 0) WHEN 0 THEN 1.0 ELSE s.currency_rate END) AS total_discount,
|
||||
CASE
|
||||
WHEN SUM(l.qty * u.factor) = 0 THEN NULL
|
||||
|
||||
@@ -13,7 +13,7 @@ class TestReportPoSOrder(TestPoSCommon):
|
||||
|
||||
def test_report_pos_order(self):
|
||||
|
||||
product1 = self.create_product('Product 1', self.categ_basic, 150)
|
||||
product1 = self.create_product('Product 1', self.categ_basic, 150, self.taxes['tax10'].id)
|
||||
|
||||
self.open_new_session()
|
||||
session = self.pos_session
|
||||
@@ -27,10 +27,10 @@ class TestReportPoSOrder(TestPoSCommon):
|
||||
'discount': 0,
|
||||
'qty': 1.0,
|
||||
'price_subtotal': 150,
|
||||
'price_subtotal_incl': 150,
|
||||
'price_subtotal_incl': 165,
|
||||
}),],
|
||||
'amount_total': 150.0,
|
||||
'amount_tax': 0.0,
|
||||
'amount_total': 165.0,
|
||||
'amount_tax': 15.0,
|
||||
'amount_paid': 0.0,
|
||||
'amount_return': 0.0,
|
||||
})
|
||||
@@ -39,3 +39,4 @@ class TestReportPoSOrder(TestPoSCommon):
|
||||
reports = self.env['report.pos.order'].sudo().search([('product_id', '=', product1.id)], order='id')
|
||||
|
||||
self.assertEqual(reports[0].margin, 150)
|
||||
self.assertEqual(reports[0].price_total, 165)
|
||||
|
||||
Reference in New Issue
Block a user