How to create Credit Memo automatically/semi-automatically

Help is preferred to those who publish their work as Open Source and not as private branches rejecting collaboration. Such projects are not maintainable and shall be deleted.
Forum rules
This forum is personally pruned to avoid redundant posts. Related topics are grouped together. IF YOU HAVE REGISTERED, you need to send email to red1(a)red1.org with your username in the subject title to get me to activate you.

How to create Credit Memo automatically/semi-automatically

Postby Jack » Tue Sep 20, 2011 11:25 am

Hi,

Anyone knows that how to create Credit Memo automatically (semi-automatically) like normal AP Invoice that in Invoice(Vendor) window, create from lines.. , then create from one receipt? I explorer the code and found below part in MInOutConfirm.java:

if (confirm.getDifferenceQty().signum() != 0
&& !inout.isSOTrx() && inout.getRef_InOut_ID() != 0)
{
log.info("Difference=" + confirm.getDifferenceQty());
if (m_creditMemo == null)
{
m_creditMemo = new MInvoice (inout, null);
m_creditMemo.setDescription(Msg.translate(getCtx(), "M_InOutConfirm_ID") + " " + getDocumentNo());
m_creditMemo.setC_DocTypeTarget_ID(MDocType.DOCBASETYPE_APCreditMemo);
m_creditMemo.saveEx();
setC_Invoice_ID(m_creditMemo.getC_Invoice_ID());
}
MInvoiceLine line = new MInvoiceLine (m_creditMemo);
line.setShipLine(confirm.getLine());


But I don't know how to make condition "inout.getRef_InOut_ID!=0" true, anyone can tell what is that Ref_InOut_ID and when I can get into creditMemo code block inside?

BTW: I read material about Compiere, it seems it works correctly as I supposed to be (credit memo should be created automatically by confirm 0 quality).
http://wiki.compiere.com/display/docs/Purchasing Also I read compiere's user manual, snapshot shows the same thing.

BR,
Jack
Jack
 
Posts: 7
Joined: Fri Sep 16, 2011 1:52 pm

Re: How to create Credit Memo automatically/semi-automatical

Postby hengsin » Tue Sep 20, 2011 1:59 pm

It should work like AP invoice. You use the same window, select credit memo instead of ap invoice document type and use create from line to create lines from vendor return/rma.

regards,
Low
hengsin
 
Posts: 37
Joined: Tue May 10, 2011 3:11 pm

Re: How to create Credit Memo automatically/semi-automatical

Postby Jack » Tue Sep 20, 2011 3:50 pm

Hi Hengsin,

Thanks for your reply. But your case is mainly from return/rma. How about the case that eg, already created AP invoice for 10 goods, then during material receipt, I only got 8 from vendor, then I have to create credit memo for 2 goods. Above compiere purchasing link ("Material Receipt / Confirmation" section) mentioned such case in compiere, but I'm not able to make it happen in ADempiere, I believe ADempiere has this function as I saw the codes I pasted above, but somehow, I'm not able to find out in what kind of situation, I can make that part of code running.

BR,
Jack
Jack
 
Posts: 7
Joined: Fri Sep 16, 2011 1:52 pm

Re: How to create Credit Memo automatically/semi-automatical

Postby Jack » Tue Sep 20, 2011 3:56 pm

I paste here something from compiere link:
For example, the Ordered Quantity is 15 but the Confirmed Quantity is 10. When the Line is saved, the Difference field is updated with a quantity of 5.

..... here it's about how to receive that 10 goods ........

Unlike the original Confirmation, the Confirmed Quantity defaults to 0. If the product had been located you would update it as appropriate. In this example, the product was short shipped and we in fact received only 10. Therefore, the Confirmed Quantity remains at 0.

Return to the Confirmation tab to complete the Confirmation.

Select the Complete button to complete the Confirmation.

The Document Status is now Completed.

The message text indicates that the Invoice (Credit Memo) was created with document number of 10000012.

To view the Credit Memo, open the Vendor Invoice window.
Jack
 
Posts: 7
Joined: Fri Sep 16, 2011 1:52 pm

Re: How to create Credit Memo automatically/semi-automatical

Postby hengsin » Thu Sep 22, 2011 2:41 pm

Does it work for you if you just comment out the "getRef_InOut_ID() != 0" condition ?

Ref_InOut_ID is for counter document. I think the condition probably means the system should only auto create ap credit memo if this is inter organization transaction. For most business, AP Credit Memo should be issue by vendor to you not something you can initiate first.

Regards,
Low
hengsin
 
Posts: 37
Joined: Tue May 10, 2011 3:11 pm

Re: How to create Credit Memo automatically/semi-automatical

Postby Jack » Fri Sep 23, 2011 2:43 pm

Hi Hengsin,

It works if I removed that getRef_InOut_ID() condition.

"I think the condition probably means the system should only auto create ap credit memo if this is inter organization transaction." I think your understanding is right if this Ref_InOut_ID means inter organization transaction. Then I start wondering whether it's a correct logic or a bug? What's your opinion Hengsin?

BTW, for several places I have met similar things that I don't know if it's a bug or I misunderstand original design from author, what's the best way to clarify? Asking questions like this in forum?

BR,
Jack
Jack
 
Posts: 7
Joined: Fri Sep 16, 2011 1:52 pm

Re: How to create Credit Memo automatically/semi-automatical

Postby hengsin » Wed Sep 28, 2011 12:24 am

From accounting perspective, vendor credit memo should be a document you received from your vendor not the other way round.

yeah, feel free to ask in forum.
hengsin
 
Posts: 37
Joined: Tue May 10, 2011 3:11 pm


Return to HELP ME!!!

Who is online

Users browsing this forum: No registered users and 4 guests