[FIX] account: _prepare_analytic_line

The field "amount" in 'account.analytic.line' must be in the currency
of the 'account.move.line' record because the "currency_id" field is over
written in "addons/account/models/account_analytic_line.py" and
this field is related to the currency of the move linked to the
analytic line.

opw:666538
This commit is contained in:
Goffin Simon
2016-01-14 09:40:08 +01:00
parent 6006c0d72a
commit 60be34c3ee
+2 -1
View File
@@ -1095,6 +1095,7 @@ class AccountMoveLine(models.Model):
""" Prepare the values used to create() an account.analytic.line upon validation of an account.move.line having
an analytic account. This method is intended to be extended in other modules.
"""
amount = (self.credit or 0.0) - (self.debit or 0.0)
return {
'name': self.name,
'date': self.date,
@@ -1102,7 +1103,7 @@ class AccountMoveLine(models.Model):
'unit_amount': self.quantity,
'product_id': self.product_id and self.product_id.id or False,
'product_uom_id': self.product_uom_id and self.product_uom_id.id or False,
'amount': (self.credit or 0.0) - (self.debit or 0.0),
'amount': self.company_currency_id.compute(amount, self.currency_id) if self.currency_id else amount,
'general_account_id': self.account_id.id,
'ref': self.ref,
'move_id': self.id,