Validate Invoice commit when complete it in GenerateInvoice - fixes #36

http://bitbucket.org/idempiere/idempiere/issue/36
Thanks to fercho_comus for pointing here
This commit is contained in:
Carlos Ruiz 2011-06-14 14:50:09 -05:00
parent 5cfcc86631
commit 21d5cc1e40
1 changed files with 4 additions and 9 deletions

View File

@ -213,7 +213,7 @@ public class InvoiceGenerate extends SvrProcess
{ {
log.warning("BPartner has no Schedule - set to After Delivery"); log.warning("BPartner has no Schedule - set to After Delivery");
order.setInvoiceRule(MOrder.INVOICERULE_AfterDelivery); order.setInvoiceRule(MOrder.INVOICERULE_AfterDelivery);
order.save(); order.saveEx();
} }
else else
{ {
@ -479,7 +479,7 @@ public class InvoiceGenerate extends SvrProcess
ips.setAD_Org_ID(ops.getAD_Org_ID()); ips.setAD_Org_ID(ops.getAD_Org_ID());
ips.setProcessing(ops.isProcessing()); ips.setProcessing(ops.isProcessing());
ips.setIsActive(ops.isActive()); ips.setIsActive(ops.isActive());
ips.save(); ips.saveEx();
} }
m_invoice.validatePaySchedule(); m_invoice.validatePaySchedule();
m_invoice.saveEx(); m_invoice.saveEx();
@ -491,13 +491,8 @@ public class InvoiceGenerate extends SvrProcess
log.warning("completeInvoice - failed: " + m_invoice); log.warning("completeInvoice - failed: " + m_invoice);
addLog("completeInvoice - failed: " + m_invoice); // Elaine 2008/11/25 addLog("completeInvoice - failed: " + m_invoice); // Elaine 2008/11/25
} }
///fercho m_invoice.save(); m_invoice.saveEx();
if (!m_invoice.save())
{
log.warning("completeInvoice - failed: " + m_invoice);
addLog("completeInvoice - failed: " + m_invoice);
}
///fercho
addLog(m_invoice.getC_Invoice_ID(), m_invoice.getDateInvoiced(), null, m_invoice.getDocumentNo()); addLog(m_invoice.getC_Invoice_ID(), m_invoice.getDateInvoiced(), null, m_invoice.getDocumentNo());
m_created++; m_created++;
} }