[FIX] point_of_sale: include untaxed amounts in tax lines

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
This commit is contained in:
Martin Trigaux
2018-01-25 13:53:56 +01:00
parent d62a26a429
commit 7ee7262ccb
2 changed files with 10 additions and 1 deletions
@@ -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
+4 -1
View File
@@ -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: