Carlos Ruiz 2011-03-26 00:39:00 -05:00
parent 278febbefb
commit 7a41c80694
3 changed files with 37 additions and 7 deletions

View File

@ -1342,11 +1342,21 @@ public class MInvoice extends X_C_Invoice implements DocAction
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
if ( getGrandTotal().signum() != 0
&& PAYMENTRULE_OnCredit.equals(getPaymentRule()))
{
if (!createPaySchedule()) if (!createPaySchedule())
{ {
m_processMsg = "@ErrorPaymentSchedule@"; m_processMsg = "@ErrorPaymentSchedule@";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
} else {
if (MInvoicePaySchedule.getInvoicePaySchedule(getCtx(), getC_Invoice_ID(), 0, get_TrxName()).length > 0)
{
m_processMsg = "@ErrorPaymentSchedule@";
return DocAction.STATUS_Invalid;
}
}
// Credit Status // Credit Status
if (isSOTrx() && !isReversal()) if (isSOTrx() && !isReversal())

View File

@ -1285,11 +1285,21 @@ public class MOrder extends X_C_Order implements DocAction
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
if ( getGrandTotal().signum() != 0
&& PAYMENTRULE_OnCredit.equals(getPaymentRule()))
{
if (!createPaySchedule()) if (!createPaySchedule())
{ {
m_processMsg = "@ErrorPaymentSchedule@"; m_processMsg = "@ErrorPaymentSchedule@";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
} else {
if (MOrderPaySchedule.getOrderPaySchedule(getCtx(), getC_Order_ID(), 0, get_TrxName()).length > 0)
{
m_processMsg = "@ErrorPaymentSchedule@";
return DocAction.STATUS_Invalid;
}
}
// Credit Check // Credit Check
if (isSOTrx()) if (isSOTrx())

View File

@ -211,6 +211,11 @@ public class MPaymentTerm extends X_C_PaymentTerm
return false; return false;
} }
// do not apply payment term if the invoice is not on credit or if total is zero
if ( (! MInvoice.PAYMENTRULE_OnCredit.equals(invoice.getPaymentRule()) )
|| invoice.getGrandTotal().signum() == 0)
return false;
if (!isValid()) if (!isValid())
return applyNoSchedule (invoice); return applyNoSchedule (invoice);
// //
@ -311,6 +316,11 @@ public class MPaymentTerm extends X_C_PaymentTerm
return false; return false;
} }
// do not apply payment term if the order is not on credit or if total is zero
if ( (! MOrder.PAYMENTRULE_OnCredit.equals(order.getPaymentRule()) )
|| order.getGrandTotal().signum() == 0)
return false;
if (!isValid()) if (!isValid())
return applyOrderNoSchedule (order); return applyOrderNoSchedule (order);
// //