[FIX] account_asset: depreciation rate date

- Activate multi-currency
- Define a rate today (e.g. 2017-06-01) and next month (e.g. 2017-07-01)
- Create a deferred revenue on 2017-07-02 in the foreign currency
- Post the first line

The rate taken is the rate of today, not the rate of next month.

opw-745509
This commit is contained in:
Nicolas Martinelli
2017-06-13 14:35:11 +02:00
parent f4ed08ceda
commit 05ef0790c9
+1 -1
View File
@@ -431,7 +431,7 @@ class AccountAssetDepreciationLine(models.Model):
depreciation_date = self.env.context.get('depreciation_date') or line.depreciation_date or fields.Date.context_today(self)
company_currency = line.asset_id.company_id.currency_id
current_currency = line.asset_id.currency_id
amount = current_currency.compute(line.amount, company_currency)
amount = current_currency.with_context(date=depreciation_date).compute(line.amount, company_currency)
asset_name = line.asset_id.name + ' (%s/%s)' % (line.sequence, len(line.asset_id.depreciation_line_ids))
reference = line.asset_id.code
journal_id = line.asset_id.category_id.journal_id.id