From 8d6ff4994888cccf1286ecde3e84cbe7116b6657 Mon Sep 17 00:00:00 2001 From: "robin.keunen" Date: Thu, 7 Jan 2021 11:56:20 +0100 Subject: [PATCH] [IMP] cep: amount sign depends on direction --- csv_export_payment/models/csv_export_payment.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/csv_export_payment/models/csv_export_payment.py b/csv_export_payment/models/csv_export_payment.py index 52fa356..7cd2aef 100644 --- a/csv_export_payment/models/csv_export_payment.py +++ b/csv_export_payment/models/csv_export_payment.py @@ -45,6 +45,17 @@ def get_row(self, record): ) invoice = payment.invoice_ids + if payment.partner_type == 'customer': + if payment.payment_type == 'inbound': + amount = payment.amount + if payment.payment_type == 'outbound': + amount = - payment.amount + if payment.partner_type == 'supplier': + if payment.payment_type == 'inbound': + amount = - payment.amount + if payment.payment_type == 'outbound': + amount = payment.amount + row = ( payment.name, payment.journal_id.code, @@ -53,7 +64,7 @@ def get_row(self, record): payment.partner_id.export_reference, invoice.number, invoice.journal_id.code, - str(payment.amount), + str(amount), ) row = tuple(self.replace_line_return(s) for s in row)