Skip to content
Permalink
Browse files

[FIX] purchase_stock: tax included in multi-currency

- Set the company currency to USD, activate multi-currency
- Create a rate of 0.5 for EUR
- Create a purchase tax T:
  Percentage: 10 %
  Included in price
- Create a PO in EUR with the followind line
  Quantity: 10.0
  Price Unit: 1.0
  Tax: T
- Validate the PO, receive the product

The journal entry is composed of 2 lines:
- debit:  18.18; amount currency:  10.0
- credit: 18.18; amount currency: -10.0

This is not correct: the amount currency should not include the tax.

In order to prevent this, we use the subtotal, and divide by the
quantity.

opw-1958287
  • Loading branch information...
nim-odoo committed Apr 18, 2019
1 parent df68900 commit c6e819453dee309fe2b530c4d8e73e09b65e46d2
Showing with 6 additions and 1 deletion.
  1. +6 −1 addons/purchase_stock/models/stock.py
@@ -60,7 +60,12 @@ def _generate_valuation_lines_data(self, partner_id, qty, debit_value, credit_va
if self.purchase_line_id:
purchase_currency = self.purchase_line_id.currency_id
if purchase_currency != self.company_id.currency_id:
purchase_price_unit = self.purchase_line_id.price_unit
# Do not use price_unit since we want the price tax excluded
purchase_price_unit = (
self.purchase_line_id.price_subtotal / self.purchase_line_id.product_qty
if self.purchase_line_id.product_qty
else self.purchase_line_id.price_unit
)
currency_move_valuation = purchase_currency.round(purchase_price_unit * abs(qty))
rslt['credit_line_vals']['amount_currency'] = rslt['credit_line_vals']['credit'] and -currency_move_valuation or currency_move_valuation
rslt['credit_line_vals']['currency_id'] = purchase_currency.id

0 comments on commit c6e8194

Please sign in to comment.
You can’t perform that action at this time.