IDEMPIERE-814 POS Sales Order generating Cash transactions
This commit is contained in:
parent
c8b2b44672
commit
f1662191a5
|
@ -66,7 +66,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 6821562060687417857L;
|
||||
private static final long serialVersionUID = -1223767990636657474L;
|
||||
|
||||
/**
|
||||
* Get Payments Of BPartner
|
||||
|
@ -1132,11 +1132,11 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
|||
* Test Allocation (and set paid flag)
|
||||
* @return true if updated
|
||||
*/
|
||||
public boolean testAllocation()
|
||||
public boolean testAllocation(boolean beingCompleted)
|
||||
{
|
||||
boolean change = false;
|
||||
|
||||
if ( isProcessed() ) {
|
||||
if ( isProcessed() || beingCompleted) {
|
||||
BigDecimal alloc = getAllocatedAmt(); // absolute
|
||||
if (alloc == null)
|
||||
alloc = Env.ZERO;
|
||||
|
@ -1156,6 +1156,10 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
|||
return change;
|
||||
} // testAllocation
|
||||
|
||||
public boolean testAllocation() {
|
||||
return testAllocation(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Paid Flag for invoices
|
||||
* @param ctx context
|
||||
|
@ -1386,13 +1390,13 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
|||
m_processMsg = "@NoLines@";
|
||||
return DocAction.STATUS_Invalid;
|
||||
}
|
||||
// No Cash Book
|
||||
if (PAYMENTRULE_Cash.equals(getPaymentRule())
|
||||
&& MCashBook.get(getCtx(), getAD_Org_ID(), getC_Currency_ID()) == null)
|
||||
{
|
||||
m_processMsg = "@NoCashBook@";
|
||||
return DocAction.STATUS_Invalid;
|
||||
}
|
||||
// No Cash Book // deprecated with IDEMPIERE-170 Complete Cash as Payment functionality
|
||||
// if (PAYMENTRULE_Cash.equals(getPaymentRule())
|
||||
// && MCashBook.get(getCtx(), getAD_Org_ID(), getC_Currency_ID()) == null)
|
||||
// {
|
||||
// m_processMsg = "@NoCashBook@";
|
||||
// return DocAction.STATUS_Invalid;
|
||||
// }
|
||||
|
||||
// Convert/Check DocType
|
||||
if (getC_DocType_ID() != getC_DocTypeTarget_ID() )
|
||||
|
@ -1773,7 +1777,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
|||
|
||||
payment.setDocAction(MPayment.DOCACTION_Complete);
|
||||
if (!payment.processIt(MPayment.DOCACTION_Complete)) {
|
||||
m_processMsg = "Cannot Complete the Payment :" + payment;
|
||||
m_processMsg = "Cannot Complete the Payment : [" + payment.getProcessMsg() + "] " + payment;
|
||||
return DocAction.STATUS_Invalid;
|
||||
}
|
||||
|
||||
|
@ -2080,6 +2084,11 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
|||
}
|
||||
}
|
||||
|
||||
if (PAYMENTRULE_Cash.equals(getPaymentRule())) {
|
||||
if (testAllocation(true)) {
|
||||
saveEx();
|
||||
}
|
||||
}
|
||||
// User Validation
|
||||
String valid = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_COMPLETE);
|
||||
if (valid != null)
|
||||
|
|
|
@ -2290,11 +2290,6 @@ public class MOrder extends X_C_Order implements DocAction
|
|||
// end added
|
||||
invoice.saveEx(get_TrxName());
|
||||
setC_CashLine_ID(invoice.getC_CashLine_ID());
|
||||
if (PAYMENTRULE_Cash.equals(invoice.getPaymentRule()) && getC_POS_ID() == 0) {
|
||||
if (invoice.testAllocation()) {
|
||||
invoice.saveEx();
|
||||
}
|
||||
}
|
||||
if (!DOCSTATUS_Completed.equals(invoice.getDocStatus()))
|
||||
{
|
||||
m_processMsg = "@C_Invoice_ID@: " + invoice.getProcessMsg();
|
||||
|
|
|
@ -1459,7 +1459,7 @@ public final class MPayment extends X_C_Payment
|
|||
{
|
||||
String sql = "SELECT idt.IsSOTrx "
|
||||
+ "FROM C_Invoice i"
|
||||
+ " INNER JOIN C_DocType idt ON (i.C_DocType_ID=idt.C_DocType_ID) "
|
||||
+ " INNER JOIN C_DocType idt ON (CASE WHEN i.C_DocType_ID=0 THEN i.C_DocTypeTarget_ID ELSE i.C_DocType_ID END=idt.C_DocType_ID) "
|
||||
+ "WHERE i.C_Invoice_ID=?";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
|
|
Loading…
Reference in New Issue