Page 1 of 1

MaterialReceipt 'create lines from' Invoice, cannot match

PostPosted: Thu Sep 09, 2004 11:38 am
by red1
This is a confirmed bug in the latest 251e. I spent 1 whole day on it but now I have located the buggy area, which involves the study of VCreateFromShipment, MInvoice, and MInOut - classes.
It doesnt look difficult to fix now that its located. :x
My time wasting cycles was because of the WorkFlow classes, which threw me offtrack as i tot they been new are taking over the processes, when in the end i found out yesterday, that they are just a plate layer (off course for workflow functions) and the real processes remain virtually the same. Thus with the circling of these 3 classes, a few lines should do the trick. Basically what i am going to do is to make the 1st class populate InvoiceLine with an M_InOutLine_ID, the prerequisite for the matching. Then i duplicate the the matching method from MInvoice into MInOut, the later which does only PO Match (again logical as a Material Receipt comes after PO). However Compiere allows the other way (from Invoice) to create lines from within MaterialReceipts, but this other way was left out. With the MatchInv method introduced in MInOut, thus solve the bug. I shall explain further in a pdf document with screenshots and background info as to the business accounting thinking that goes behind it.

OK, the snippet needed to add in the CreateFromShipment is :

//red1 save InvoiceLine with this M_InOutLine_ID
m_invoiceline = new MInvoiceLine (Env.getCtx(), C_InvoiceLine_ID); //red1 -- get the InvoiceLine
if (!
Log.error("VCFS - red1 - Not Updated #" + i);//red1 saving its InOutLineID -- end --
} // if selected
} // for all rows

The snippet needed for MInOut is:

else //red1 Inv Matching
int InvLineID = DB.getSQLValue(
"SELECT C_InvoiceLine_ID FROM C_InvoiceLine WHERE M_InOutLine_ID=?",
if (!isSOTrx() && InvLineID != -1)
mInvLine = new MInvoiceLine(Env.getCtx(), InvLineID);
BigDecimal matchQty = mInvLine.getQtyInvoiced();

MMatchInv inv = new MMatchInv(mInvLine, getMovementDate(), matchQty);
if (!
m_processMsg = "Could not create Inventory Matching";
return DocAction.STATUS_Invalid;
} //red1 -- end --

} // for all lines

remember, i will explain at length as well as some Compiere Java 101 in a PDF doc with illustrations so watch this thread :!:

PostPosted: Sun Sep 12, 2004 9:49 am
by red1
As was divinely ordained, here is the tutorial :

All ideas and knowledge belongs to the All-Powerfull.
Spread the Lord's good work! :wink: