From 60be34c3eefada0b88d427ac89362fc80d33279e Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Wed, 13 Jan 2016 16:25:16 +0100 Subject: [PATCH] =?UTF-8?q?[FIX]=C2=A0account:=20=5Fprepare=5Fanalytic=5Fl?= =?UTF-8?q?ine?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- addons/account/models/account_move.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 24eb0312a48..11d8de6f2b4 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -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,