BF [ 2588326 ] Cash Lines are not correctly updated on voiding
https://sourceforge.net/tracker/index.php?func=detail&aid=2588326&group_id=176962&atid=879332 * Better exception handling
This commit is contained in:
parent
34a5b37c55
commit
9895920594
|
@ -46,11 +46,15 @@ import org.compiere.util.TimeUtil;
|
||||||
* <li>BF [ 1831997 ] Cash journal allocation reversed
|
* <li>BF [ 1831997 ] Cash journal allocation reversed
|
||||||
* <li>BF [ 1894524 ] Pay an reversed invoice
|
* <li>BF [ 1894524 ] Pay an reversed invoice
|
||||||
* <li>BF [ 1899477 ] MCash.getLines should return only active lines
|
* <li>BF [ 1899477 ] MCash.getLines should return only active lines
|
||||||
|
* <li>BF [ 2588326 ] Cash Lines are not correctly updated on voiding
|
||||||
*/
|
*/
|
||||||
public class MCash extends X_C_Cash implements DocAction
|
public class MCash extends X_C_Cash implements DocAction
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 9153922329895288746L;
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Cash Journal for currency, org and date
|
* Get Cash Journal for currency, org and date
|
||||||
|
@ -126,7 +130,7 @@ public class MCash extends X_C_Cash implements DocAction
|
||||||
|
|
||||||
// Create New Journal
|
// Create New Journal
|
||||||
retValue = new MCash (cb, dateAcct);
|
retValue = new MCash (cb, dateAcct);
|
||||||
retValue.save(trxName);
|
retValue.saveEx(trxName);
|
||||||
return retValue;
|
return retValue;
|
||||||
} // get
|
} // get
|
||||||
|
|
||||||
|
@ -627,18 +631,18 @@ public class MCash extends X_C_Cash implements DocAction
|
||||||
|
|
||||||
MPayment payment = new MPayment(getCtx(), cashline.getC_Payment_ID(),get_TrxName());
|
MPayment payment = new MPayment(getCtx(), cashline.getC_Payment_ID(),get_TrxName());
|
||||||
payment.reverseCorrectIt();
|
payment.reverseCorrectIt();
|
||||||
if (!payment.save())
|
payment.saveEx();
|
||||||
throw new IllegalStateException("Cannot reverse payment");
|
|
||||||
}
|
}
|
||||||
|
cashline.saveEx();
|
||||||
}
|
}
|
||||||
|
|
||||||
setName(getName()+"^");
|
setName(getName()+"^");
|
||||||
addDescription(Msg.getMsg(getCtx(), "Voided"));
|
addDescription(Msg.getMsg(getCtx(), "Voided"));
|
||||||
setDocStatus(DOCSTATUS_Reversed); // for direct calls
|
setDocStatus(DOCSTATUS_Reversed); // for direct calls
|
||||||
setProcessed(true);
|
setProcessed(true);
|
||||||
|
setPosted(true);
|
||||||
setDocAction(DOCACTION_None);
|
setDocAction(DOCACTION_None);
|
||||||
if (!save())
|
saveEx();
|
||||||
throw new IllegalStateException("Cannot save journal cash");
|
|
||||||
|
|
||||||
// Delete Posting
|
// Delete Posting
|
||||||
MFactAcct.deleteEx(Table_ID, getC_Cash_ID(), get_TrxName());
|
MFactAcct.deleteEx(Table_ID, getC_Cash_ID(), get_TrxName());
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
* This program is free software; you can redistribute it and/or modify it *
|
||||||
* under the terms version 2 of the GNU General Public License as published *
|
* under the terms version 2 of the GNU General Public License as published *
|
||||||
|
@ -38,6 +38,12 @@ import org.compiere.util.Msg;
|
||||||
*/
|
*/
|
||||||
public class MCashLine extends X_C_CashLine
|
public class MCashLine extends X_C_CashLine
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 2962077554051498950L;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Standard Constructor
|
* Standard Constructor
|
||||||
* @param ctx context
|
* @param ctx context
|
||||||
|
@ -146,10 +152,10 @@ public class MCashLine extends X_C_CashLine
|
||||||
//
|
//
|
||||||
if (MOrder.DOCSTATUS_WaitingPayment.equals(order.getDocStatus()))
|
if (MOrder.DOCSTATUS_WaitingPayment.equals(order.getDocStatus()))
|
||||||
{
|
{
|
||||||
save(trxName);
|
saveEx(trxName);
|
||||||
order.setC_CashLine_ID(getC_CashLine_ID());
|
order.setC_CashLine_ID(getC_CashLine_ID());
|
||||||
order.processIt(MOrder.ACTION_WaitComplete);
|
order.processIt(MOrder.ACTION_WaitComplete);
|
||||||
order.save(trxName);
|
order.saveEx(trxName);
|
||||||
// Set Invoice
|
// Set Invoice
|
||||||
MInvoice[] invoices = order.getInvoices();
|
MInvoice[] invoices = order.getInvoices();
|
||||||
int length = invoices.length;
|
int length = invoices.length;
|
||||||
|
@ -298,9 +304,9 @@ public class MCashLine extends X_C_CashLine
|
||||||
protected boolean beforeSave (boolean newRecord)
|
protected boolean beforeSave (boolean newRecord)
|
||||||
{
|
{
|
||||||
// Cannot change generated Invoices
|
// Cannot change generated Invoices
|
||||||
if (is_ValueChanged("C_Invoice_ID"))
|
if (is_ValueChanged(COLUMNNAME_C_Invoice_ID))
|
||||||
{
|
{
|
||||||
Object generated = get_ValueOld("IsGenerated");
|
Object generated = get_ValueOld(COLUMNNAME_IsGenerated);
|
||||||
if (generated != null && ((Boolean)generated).booleanValue())
|
if (generated != null && ((Boolean)generated).booleanValue())
|
||||||
{
|
{
|
||||||
log.saveError("Error", Msg.getMsg(getCtx(), "CannotChangeCashGenInvoice"));
|
log.saveError("Error", Msg.getMsg(getCtx(), "CannotChangeCashGenInvoice"));
|
||||||
|
|
Loading…
Reference in New Issue