[FIX] hr_expense: Encoding negative amount in expense

Before this commit: 15fa0c23d9
It was possible to encode negative amount for an hr.expense.

Before the fix, it raised a Error saying:

"Cannot create unbalanced journal entry."

opw:2036620

closes odoo/odoo#34953

Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
This commit is contained in:
Goffin Simon
2019-07-22 07:38:53 +00:00
parent 5e699c65dc
commit f58fa65c2b
+2 -2
View File
@@ -312,8 +312,8 @@ class HrExpense(models.Model):
'currency_id': expense.currency_id.id if different_currency else False,
}
move_line_values.append(move_line_src)
total_amount -= move_line_src['debit']
total_amount_currency -= move_line_src['amount_currency'] or move_line_src['debit']
total_amount += -move_line_src['debit'] or move_line_src['credit']
total_amount_currency += -move_line_src['amount_currency'] if move_line_src['currency_id'] else (-move_line_src['debit'] or move_line_src['credit'])
# taxes move lines
for tax in taxes['taxes']: