From 7ee7262ccbc23a0e4d5fd241d6c740a6c80307c8 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Thu, 25 Jan 2018 13:31:39 +0100 Subject: [PATCH] [FIX] point_of_sale: include untaxed amounts in tax lines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If some orders have no taxes (e.g. manual reimbursement with a negative amount) the sum of taxes lines gave a different result than the total amount sold. e.g.: order 1: price 10€, including 2€ for taxes order 2: price -5€, no taxes report: taxes: 20%, 2€ taxes, 8€ base amount total sold: 5€ 2+8 != 5 Also change line.price_subtotal as it was computed twice if there was two taxes on a line (although it will probably never happen in the pos) opw-805415 --- addons/point_of_sale/i18n/point_of_sale.pot | 6 ++++++ addons/point_of_sale/models/pos_order.py | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/addons/point_of_sale/i18n/point_of_sale.pot b/addons/point_of_sale/i18n/point_of_sale.pot index 47f0c69bb4e..93dbbeaea58 100644 --- a/addons/point_of_sale/i18n/point_of_sale.pot +++ b/addons/point_of_sale/i18n/point_of_sale.pot @@ -1649,6 +1649,12 @@ msgstr "" msgid "No sequence defined on the journal" msgstr "" +#. module: point_of_sale +#: code:addons/point_of_sale/models/pos_order.py:986 +#, python-format +msgid "No Taxes" +msgstr "" + #. module: point_of_sale #. openerp-web #: code:addons/point_of_sale/static/src/js/screens.js:2018 diff --git a/addons/point_of_sale/models/pos_order.py b/addons/point_of_sale/models/pos_order.py index be3879bbbd7..855ae283775 100644 --- a/addons/point_of_sale/models/pos_order.py +++ b/addons/point_of_sale/models/pos_order.py @@ -981,7 +981,10 @@ class ReportSaleDetails(models.AbstractModel): for tax in line_taxes['taxes']: taxes.setdefault(tax['id'], {'name': tax['name'], 'tax_amount':0.0, 'base_amount':0.0}) taxes[tax['id']]['tax_amount'] += tax['amount'] - taxes[tax['id']]['base_amount'] += line.price_subtotal + taxes[tax['id']]['base_amount'] += tax['base'] + else: + taxes.setdefault(0, {'name': _('No Taxes'), 'tax_amount':0.0, 'base_amount':0.0}) + taxes[0]['base_amount'] += line.price_subtotal_incl st_line_ids = self.env["account.bank.statement.line"].search([('pos_statement_id', 'in', orders.ids)]).ids if st_line_ids: