[FIX] account: wrong amount with _prepare_analytic_line

To have the right sign, amount = debit - credit

Before the fix:
 -Create an invoice in another currency than the currency of your company
 -Link the invoice lines to an analytic account.
 -Validate the invoice.

Bug:
The analytic lines have a negative amount in the amount currency field
which was a bit stange as it is the opposite sign than the amount in the company currency.

opw:692557
This commit is contained in:
Goffin Simon
2016-11-08 11:53:01 +01:00
parent 6171f50e85
commit 7fca8ad89e
+1 -1
View File
@@ -1222,7 +1222,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)
amount = (self.debit or 0.0) - (self.credit or 0.0)
return {
'name': self.name,
'date': self.date,