diff --git a/addons/point_of_sale/report/pos_order_report.py b/addons/point_of_sale/report/pos_order_report.py index 4321e037366..0d791effebc 100644 --- a/addons/point_of_sale/report/pos_order_report.py +++ b/addons/point_of_sale/report/pos_order_report.py @@ -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 diff --git a/addons/point_of_sale/tests/test_report_pos_order.py b/addons/point_of_sale/tests/test_report_pos_order.py index 0aa069129f6..6c6ae5a4451 100644 --- a/addons/point_of_sale/tests/test_report_pos_order.py +++ b/addons/point_of_sale/tests/test_report_pos_order.py @@ -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)