[FIX] account_bank_statement_import_online_transferwise: fix fees with top-up

This commit is contained in:
Alexey Pelykh
2020-10-17 20:10:35 +03:00
parent ccffd75f02
commit 3f073e38bf

View File

@@ -1,4 +1,5 @@
# Copyright 2019 Brainbean Apps (https://brainbeanapps.com)
# Copyright 2020 CorporateHub (https://corporatehub.eu)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from dateutil.relativedelta import relativedelta
@@ -169,9 +170,7 @@ class OnlineBankStatementProviderTransferwise(models.Model):
)
amount = transaction['amount']
amount_value = amount.get('value', 0)
fees_value = total_fees.get('value', Decimal()).copy_abs()
if amount_value.is_signed():
fees_value = fees_value.copy_negate()
fees_value = total_fees.get('value', Decimal()).copy_negate()
amount_value -= fees_value
unique_import_id = '%s-%s-%s' % (
transaction['type'],