[FIX] account: currency round amounts for exchange rate difference

The method `create_exchange_rate_entry` is called
either if one of the two parameter
`amount_diff` or `diff_in_currency` is not equal to 0.0
(or, near to zero, `float_is_zero`):

```
if currency and aml_to_balance \
and (float_is_zero(total_amount_currency, precision_rounding=currency.rounding) \
or float_compare(total_debit, total_credit, precision_rounding=currency.rounding) == 0):
```

Nevertheless, the method is called with the amounts not rounded,
and, therefore, one could be considered to 0.0 (if
closed to 0.0) but not be exactly equal to 0.00,
and it should therefore be rounded before the entries
creation.

opw-673854
This commit is contained in:
Denis Ledoux
2016-04-15 15:47:10 +02:00
parent c538bedd53
commit cbc0dace38
+2
View File
@@ -1232,6 +1232,8 @@ class AccountPartialReconcile(models.Model):
if move_date > rec.company_id.fiscalyear_lock_date:
move_vals['date'] = move_date
move = rec.env['account.move'].create(move_vals)
amount_diff = rec.company_id.currency_id.round(amount_diff)
diff_in_currency = currency.round(diff_in_currency)
line_to_reconcile = rec.env['account.move.line'].with_context(check_move_validity=False).create({
'name': _('Currency exchange rate difference'),
'debit': amount_diff < 0 and -amount_diff or 0.0,