IDEMPIERE-365 Review credit limit check on Invoice, especially for Credit Memos
This commit is contained in:
parent
0625cd9fd9
commit
2f6dedf643
|
@ -1422,7 +1422,13 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
||||||
}
|
}
|
||||||
|
|
||||||
// Credit Status
|
// Credit Status
|
||||||
if (isSOTrx() && !isReversal())
|
if (isSOTrx())
|
||||||
|
{
|
||||||
|
MDocType doc = (MDocType) getC_DocTypeTarget();
|
||||||
|
// IDEMPIERE-365 - just check credit if is going to increase the debt
|
||||||
|
if ( (doc.getDocBaseType().equals(MDocType.DOCBASETYPE_ARCreditMemo) && getGrandTotal().signum() < 0 ) ||
|
||||||
|
(doc.getDocBaseType().equals(MDocType.DOCBASETYPE_ARInvoice) && getGrandTotal().signum() > 0 )
|
||||||
|
)
|
||||||
{
|
{
|
||||||
MBPartner bp = new MBPartner (getCtx(), getC_BPartner_ID(), null);
|
MBPartner bp = new MBPartner (getCtx(), getC_BPartner_ID(), null);
|
||||||
if ( MBPartner.SOCREDITSTATUS_CreditStop.equals(bp.getSOCreditStatus()) )
|
if ( MBPartner.SOCREDITSTATUS_CreditStop.equals(bp.getSOCreditStatus()) )
|
||||||
|
@ -1433,6 +1439,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
||||||
return DocAction.STATUS_Invalid;
|
return DocAction.STATUS_Invalid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Landed Costs
|
// Landed Costs
|
||||||
if (!isSOTrx())
|
if (!isSOTrx())
|
||||||
|
|
|
@ -1333,6 +1333,9 @@ public class MOrder extends X_C_Order implements DocAction
|
||||||
} else {
|
} else {
|
||||||
MBPartner bp = new MBPartner (getCtx(), getBill_BPartner_ID(), get_TrxName()); // bill bp is guaranteed on beforeSave
|
MBPartner bp = new MBPartner (getCtx(), getBill_BPartner_ID(), get_TrxName()); // bill bp is guaranteed on beforeSave
|
||||||
|
|
||||||
|
if (getGrandTotal().signum() > 0) // IDEMPIERE-365 - just check credit if is going to increase the debt
|
||||||
|
{
|
||||||
|
|
||||||
if (MBPartner.SOCREDITSTATUS_CreditStop.equals(bp.getSOCreditStatus()))
|
if (MBPartner.SOCREDITSTATUS_CreditStop.equals(bp.getSOCreditStatus()))
|
||||||
{
|
{
|
||||||
m_processMsg = "@BPartnerCreditStop@ - @TotalOpenBalance@="
|
m_processMsg = "@BPartnerCreditStop@ - @TotalOpenBalance@="
|
||||||
|
@ -1359,6 +1362,7 @@ public class MOrder extends X_C_Order implements DocAction
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_PREPARE);
|
m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_PREPARE);
|
||||||
if (m_processMsg != null)
|
if (m_processMsg != null)
|
||||||
|
|
Loading…
Reference in New Issue