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,10 +1342,20 @@ public class MInvoice extends X_C_Invoice implements DocAction
return DocAction.STATUS_Invalid;
}
if (!createPaySchedule())
if ( getGrandTotal().signum() != 0
&& PAYMENTRULE_OnCredit.equals(getPaymentRule()))
{
m_processMsg = "@ErrorPaymentSchedule@";
return DocAction.STATUS_Invalid;
if (!createPaySchedule())
{
m_processMsg = "@ErrorPaymentSchedule@";
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

View File

@ -1285,10 +1285,20 @@ public class MOrder extends X_C_Order implements DocAction
return DocAction.STATUS_Invalid;
}
if (!createPaySchedule())
if ( getGrandTotal().signum() != 0
&& PAYMENTRULE_OnCredit.equals(getPaymentRule()))
{
m_processMsg = "@ErrorPaymentSchedule@";
return DocAction.STATUS_Invalid;
if (!createPaySchedule())
{
m_processMsg = "@ErrorPaymentSchedule@";
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

View File

@ -211,6 +211,11 @@ public class MPaymentTerm extends X_C_PaymentTerm
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())
return applyNoSchedule (invoice);
//
@ -311,6 +316,11 @@ public class MPaymentTerm extends X_C_PaymentTerm
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())
return applyOrderNoSchedule (order);
//