MaterialReceipt 'create lines from' Invoice, cannot match

Whenever bugs are encountered they are quashed and reported. Here you can see their quashings up close.

Moderators: sureshquest, arulmani, trifon

MaterialReceipt 'create lines from' Invoice, cannot match

Postby red1 » Thu Sep 09, 2004 11:38 am

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.
:roll:

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
m_invoiceline.setM_InOutLine_ID(iol.getM_InOutLine_ID());
if (!m_invoiceline.save())
Log.error("VCFS - red1 InvLine.save - Not Updated #" + i);//red1 saving its InOutLineID -- end --
} // if selected
} // for all rows

:arrow:
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=?",
line.getM_InOutLine_ID());
if (!isSOTrx() && InvLineID != -1)
{
mInvLine = new MInvoiceLine(Env.getCtx(), InvLineID);
BigDecimal matchQty = mInvLine.getQtyInvoiced();

MMatchInv inv = new MMatchInv(mInvLine, getMovementDate(), matchQty);
if (!inv.save())
{
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 :!:
red1
Site Admin
 
Posts: 2740
Joined: Tue Jul 06, 2004 3:01 pm
Location: Kuala Lumpur, Malaysia

Postby red1 » Sun Sep 12, 2004 9:49 am

As was divinely ordained, here is the tutorial : http://compiere.red1.org/MixMatchInv.zip

All ideas and knowledge belongs to the All-Powerfull.
Spread the Lord's good work! :wink:
red1
Site Admin
 
Posts: 2740
Joined: Tue Jul 06, 2004 3:01 pm
Location: Kuala Lumpur, Malaysia


Return to BUGS Galore!

Who is online

Users browsing this forum: No registered users and 1 guest

cron