IDEMPIERE-4821 - Fix missing transaction in invoice creation from commission (#712)

This commit is contained in:
Ricardo Santana 2021-06-08 20:39:23 -03:00 committed by Carlos Ruiz
parent fa0b52abd6
commit 474e061d9c
1 changed files with 5 additions and 2 deletions

View File

@ -26,6 +26,7 @@ import org.compiere.model.MDocType;
import org.compiere.model.MInvoice;
import org.compiere.model.MInvoiceLine;
import org.compiere.util.Env;
import org.compiere.util.Msg;
/**
* Create AP Invoices for Commission
@ -75,7 +76,7 @@ public class CommissionAPInvoice extends SvrProcess
throw new IllegalArgumentException("CommissionAPInvoice - No BPartner");
// Create Invoice
MInvoice invoice = new MInvoice (getCtx(), 0, null);
MInvoice invoice = new MInvoice (getCtx(), 0, get_TrxName());
invoice.setClientOrg(com.getAD_Client_ID(), com.getAD_Org_ID());
invoice.setC_DocTypeTarget_ID(MDocType.DOCBASETYPE_APInvoice); // API
invoice.setBPartner(bp);
@ -97,7 +98,9 @@ public class CommissionAPInvoice extends SvrProcess
if (!iLine.save())
throw new IllegalStateException("CommissionAPInvoice - cannot save Invoice Line");
//
return "@C_Invoice_ID@ = " + invoice.getDocumentNo();
addBufferLog(invoice.get_ID(), null, null, Msg.getElement(getCtx(), MInvoice.COLUMNNAME_C_Invoice_ID) + " #" + invoice.getDocumentNo(), MInvoice.Table_ID, invoice.get_ID());
//
return "@Success@";
} // doIt
} // CommissionAPInvoice