Fixed bug 9236: If you void an invoice with document type defined as AR Credit memo, the new invoice created is posted incorrectly
authorVíctor Martínez Romanos <victor.martinez@openbravo.com>
Mon, 01 Jun 2009 17:15:27 +0200
changeset 3938 170ff8ddfefc
parent 3937 5ea129735572
child 3939 87f54d2c3ce0
Fixed bug 9236: If you void an invoice with document type defined as AR Credit memo, the new invoice created is posted incorrectly
src/org/openbravo/erpCommon/ad_forms/DocInvoice.java
--- a/src/org/openbravo/erpCommon/ad_forms/DocInvoice.java	Mon Jun 01 16:03:39 2009 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/DocInvoice.java	Mon Jun 01 17:15:27 2009 +0200
@@ -323,19 +323,10 @@
       for (int i = 0; m_debt_payments != null && i < m_debt_payments.length; i++) {
         BigDecimal amount = new BigDecimal(m_debt_payments[i].Amount);
         BigDecimal ZERO = BigDecimal.ZERO;
-        if ((amount.compareTo(ZERO) > 0 && m_debt_payments[i].isReceipt.equals("Y"))
-            || (amount.compareTo(ZERO) < 0 && m_debt_payments[i].isReceipt.equals("N")))
-          fact.createLine(m_debt_payments[i], getAccountBPartner(C_BPartner_ID, as, true,
-              m_debt_payments[i].dpStatus, conn), this.C_Currency_ID, getConvertedAmt(((amount
-              .negate())).toPlainString(), m_debt_payments[i].C_Currency_ID_From,
-              this.C_Currency_ID, DateAcct, "", conn), "", Fact_Acct_Group_ID, nextSeqNo(SeqNo),
-              DocumentType, conn);
-        else
-          fact.createLine(m_debt_payments[i], getAccountBPartner(C_BPartner_ID, as, true,
-              m_debt_payments[i].dpStatus, conn), this.C_Currency_ID, "", getConvertedAmt(((amount
-              .negate())).toPlainString(), m_debt_payments[i].C_Currency_ID_From,
-              this.C_Currency_ID, DateAcct, "", conn), Fact_Acct_Group_ID, nextSeqNo(SeqNo),
-              DocumentType, conn);
+        fact.createLine(m_debt_payments[i], getAccountBPartner(C_BPartner_ID, as, true,
+            m_debt_payments[i].dpStatus, conn), this.C_Currency_ID, "", getConvertedAmt(((amount
+            .negate())).toPlainString(), m_debt_payments[i].C_Currency_ID_From, this.C_Currency_ID,
+            DateAcct, "", conn), Fact_Acct_Group_ID, nextSeqNo(SeqNo), DocumentType, conn);
       }
 
       // fact.createLine(null,
@@ -418,19 +409,10 @@
       for (int i = 0; m_debt_payments != null && i < m_debt_payments.length; i++) {
         BigDecimal amount = new BigDecimal(m_debt_payments[i].Amount);
         BigDecimal ZERO = BigDecimal.ZERO;
-        if ((amount.compareTo(ZERO) < 0 && m_debt_payments[i].isReceipt.equals("Y"))
-            || (amount.compareTo(ZERO) > 0 && m_debt_payments[i].isReceipt.equals("N")))
-          fact.createLine(m_debt_payments[i], getAccountBPartner(C_BPartner_ID, as, false,
-              m_debt_payments[i].dpStatus, conn), this.C_Currency_ID, "", getConvertedAmt(((amount
-              .negate())).toPlainString(), m_debt_payments[i].C_Currency_ID_From,
-              this.C_Currency_ID, DateAcct, "", conn), Fact_Acct_Group_ID, nextSeqNo(SeqNo),
-              DocumentType, conn);
-        else
-          fact.createLine(m_debt_payments[i], getAccountBPartner(C_BPartner_ID, as, false,
-              m_debt_payments[i].dpStatus, conn), this.C_Currency_ID, getConvertedAmt(((amount
-              .negate())).toPlainString(), m_debt_payments[i].C_Currency_ID_From,
-              this.C_Currency_ID, DateAcct, "", conn), "", Fact_Acct_Group_ID, nextSeqNo(SeqNo),
-              DocumentType, conn);
+        fact.createLine(m_debt_payments[i], getAccountBPartner(C_BPartner_ID, as, false,
+            m_debt_payments[i].dpStatus, conn), this.C_Currency_ID, getConvertedAmt(((amount
+            .negate())).toPlainString(), m_debt_payments[i].C_Currency_ID_From, this.C_Currency_ID,
+            DateAcct, "", conn), "", Fact_Acct_Group_ID, nextSeqNo(SeqNo), DocumentType, conn);
       }
 
       // fact.createLine (null,
@@ -465,7 +447,7 @@
     }
     SeqNo = "0";
     return fact;
-  } // createFact
+  }// createFact
 
   /**
    * Update Product Info. - Costing (PriceLastInv) - PO (PriceLastInv)