RMA Validator

This commit is contained in:
hodianto 2018-04-05 20:18:32 +07:00
parent 08458e7f15
commit 72a59a4901
1 changed files with 2 additions and 4 deletions

View File

@ -92,13 +92,11 @@ public class MID_RMAValidator {
iLine.setQtyInvoiced(line.getQty());
iLine.saveEx();
}
invoice.processIt(DocAction.ACTION_Complete);
invoice.saveEx();
MInvoice invoiceUsed = new MInvoice(RMA.getCtx (), order.getC_Invoice_ID(), RMA.get_TrxName());
if(invoiceUsed.getC_Payment_ID()>0 && (invoice.getC_Order().getC_DocType_ID()==1000135 || invoice.getC_Order().getC_DocType_ID()==135)) {
if(invoiceUsed.getC_Payment_ID()>0 && (invoiceUsed.getC_Order().getC_DocTypeTarget_ID()==135 || invoiceUsed.getC_Order().getC_DocTypeTarget_ID()==1000135 || invoiceUsed.getC_Order().getC_DocType_ID()==1000135 || invoiceUsed.getC_Order().getC_DocType_ID()==135)) {
MPayment payment = new MPayment(RMA.getCtx(), 0, RMA.get_TrxName());
payment.setC_Invoice_ID(invoice.get_ID());
// payment.setC_Order_ID(invoice.getC_Order_ID());
payment.setIsReceipt(invoice.isSOTrx());
@ -107,8 +105,8 @@ public class MID_RMAValidator {
payment.setC_BPartner_ID(invoice.getC_BPartner_ID());
payment.setAmount(invoice.getC_Currency_ID(), invoice.getGrandTotal().negate());
payment.setC_BankAccount_ID(invoiceUsed.getC_Payment().getC_BankAccount_ID());
payment.setDescription("Return Material and Payment for POS Invoice No : "+invoiceUsed.getDocumentNo()+" and Payment ID : "+invoiceUsed.getC_Payment_ID());
payment.saveEx();
payment.processIt(DocAction.ACTION_Complete);
payment.saveEx();
}