]> wagnertech.de Git - kivitendo-erp.git/blobdiff - SL/Controller/BankTransaction.pm
behebt #242 Negative Verkaufsrechnungen mit Bankbewegung verknüpfen
[kivitendo-erp.git] / SL / Controller / BankTransaction.pm
index f93bfd79e3500ed42e0ee2172304a68211877547..52d43e1d6657563be2260d7245ce3091eaf27c24 100644 (file)
@@ -669,7 +669,8 @@ sub save_single_bank_transaction {
       } else {
         # use the whole amount of the bank transaction for the invoice, overpay the invoice if necessary
 
-        if ( $invoice->is_sales && $invoice->invoice_type eq 'credit_note' ) {
+        # this catches credit_notes and negative sales invoices
+        if ( $invoice->is_sales && $invoice->amount < 0 ) {
           # $invoice->open_amount     is negative for credit_notes
           # $bank_transaction->amount is negative for outgoing transactions
           # so $amount_of_transaction is negative but needs positive