IDEMPIERE-3761 Process "Create AP Expense Invoices" creates wrong AP and expense postings if product's price list "isTaxIncluded=Y"

This commit is contained in:
Heng Sin Low 2018-08-08 11:15:23 +08:00
parent 1e208691d0
commit bfcf88748a
1 changed files with 6 additions and 0 deletions

View File

@ -25,6 +25,7 @@ import org.compiere.model.MBPartner;
import org.compiere.model.MDocType;
import org.compiere.model.MInvoice;
import org.compiere.model.MInvoiceLine;
import org.compiere.model.MPriceList;
import org.compiere.model.MTimeExpense;
import org.compiere.model.MTimeExpenseLine;
import org.compiere.util.DB;
@ -136,6 +137,10 @@ public class ExpenseAPInvoice extends SvrProcess
break;
}
invoice.setM_PriceList_ID(te.getM_PriceList_ID());
MPriceList pl = MPriceList.get(getCtx(), te.getM_PriceList_ID(), get_TrxName());
invoice.setIsTaxIncluded(pl.isTaxIncluded());
invoice.setSalesRep_ID(te.getDoc_User_ID());
StringBuilder descr = new StringBuilder().append(Msg.translate(getCtx(), "S_TimeExpense_ID"))
.append(": ").append(te.getDocumentNo()).append(" " )
@ -182,6 +187,7 @@ public class ExpenseAPInvoice extends SvrProcess
//
// il.setPrice(); // not really a list/limit price for reimbursements
il.setPrice(line.getPriceReimbursed()); //
il.setTax();
if (!il.save())
throw new IllegalStateException("Cannot save Invoice Line");