Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0006612Openbravo ERP09. Financial managementpublic2008-12-17 13:352009-01-25 20:17
networkb 
eduardo_Argal 
immediatemajoralways
closedfixed 
20
2.40 
2.40MP2 
Core
No
0006612: An invoice (AP creditmemo) with negative amount and Cash form of payment creates wrong cash journal line
When an invoice (AP creditmemo) that has form of payment Cash and negative amount is completed (C_INVOICE_POST procedure), the amount of the cash journal line created is wrong. It creates a line in the cash journal but with positive amount when it should be negative.
Then you are not able to post the cash journal because the amount of the line does not match with the amount of the dept payment.
1-Create a purchase invoice with form of payment cash and Transaction Document: AP creditmemo
2-Create a line with a negative quantity (the total amount is negative)
3-Complete the invoice
4-It will create a cash journal with its line in the same date as the date of the invoice(financial management->Receivables%payables->Transactions->Cash journal)
5-Go to Payment tab and see that the Amount is positive (correct).
6-Go to Cash Journal window and to Lines tab. You will see a new line but the amount has not the quantity like the invoice we have posted. Instead of being negative, it is positive.
6-Try to complete the cash journal, and you get the following error:
Error:
In line10 the amount does not match with amount of the debt payment
Review the procedure C_INVOICE_POST [1] since it is inserting badly the cash journal line when the invoice is of document type AP Credit Memo.

Review line:

INSERT
  INTO C_CASHLINE
    (
      C_CashLine_ID, AD_Client_ID, AD_Org_ID, IsActive,
      Created, CreatedBy, Updated, UpdatedBy,
      C_Cash_ID, C_Debt_Payment_ID, Line, Description,
      Amount, CashType, C_Currency_ID, DiscountAmt,
      WriteOffAmt, IsGenerated
    )
    VALUES
    (
      v_CashLine, v_Client_ID, v_Org_ID, 'Y',
      now(), v_UpdatedBy, now(), v_UpdatedBy,
      v_Cash, v_debtPaymentID, v_line, v_BPartnerName,
      C_Currency_Convert((CASE v_IsSOTrx WHEN 'Y' THEN v_paymentAmount ELSE -v_paymentAmount END), v_Currency_ID, v_CB_Curr,v_DateAcct,NULL,v_Client_ID, v_Org_ID), 'P', v_Currency_ID, 0,
      0, 'Y'
    )

[1] https://dev.openbravo.com/websvn/openbravo/trunk/src-db/database/model/functions/C_INVOICE_POST.xml [^]
No tags attached.
blocks defect 0006600 closed eduardo_Argal An invoice (AP creditmemo) with negative amount and Cash form of payment creates wrong cash journal line 
Issue History
2008-12-17 13:35rafarodaNew Issue
2008-12-17 13:35rafarodaAssigned To => eduardo_Argal
2008-12-17 13:35rafarodaStatusnew => scheduled
2008-12-17 13:58psarobeProposed Solution updated
2008-12-18 17:53svnbotCheckin
2008-12-18 17:53svnbotNote Added: 0011546
2008-12-18 17:53svnbotStatusscheduled => resolved
2008-12-18 17:53svnbotResolutionopen => fixed
2008-12-18 17:53svnbotsvn_revision => 11391
2009-01-25 20:17psarobeRegression testing => No
2009-01-25 20:17psarobeStatusresolved => closed

Notes
(0011546)
svnbot   
2008-12-18 17:53   
Repository: openbravo
Revision: 11391
Author: eduardoargal
Date: 2008-12-18 17:53:24 +0100 (Thu, 18 Dec 2008)

Fixes bug 0006612: An invoice (AP creditmemo) with negative amount and Cash form of payment creates wrong cash journal line

---
U branches/r2.40/src-db/database/model/functions/C_INVOICE_POST.xml
---

https://dev.openbravo.com/websvn/openbravo/?rev=11391&sc=1 [^]