Skip to content

Commit

Permalink
Fix NPE on CalloutContract
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosaparadam committed Feb 23, 2024
1 parent aeb849a commit 292400e
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,16 +172,18 @@ class CalloutContract extends CalloutEngine {
import org.adempiere.core.domains.models.I_S_Contract
val contract = GridTabWrapper.create(gridTab, classOf[I_S_Contract])
val priceListId = contract.getM_PriceList_ID
if priceListId < 0 then return ""
if priceListId <= 0 then return ""

val priceList = MPriceList.get(context, priceListId, null)
val isTaxIncluded = priceList.isTaxIncluded
val currencyId = priceList.getC_Currency_ID
val contractDate = Env.getContextAsDate(context, windowNo, I_S_Contract.COLUMNNAME_DateContract)
val priceListVersion = priceList.getPriceListVersion(contractDate)
contract.setIsTaxIncluded(isTaxIncluded)
contract.setC_Currency_ID(currencyId)
Env.setContext(context, windowNo, "M_PriceList_Version_ID", priceListVersion.get_ID())
val priceListVersion = priceList.getPriceListVersion(contractDate)
if priceListVersion != null then {
Env.setContext(context, windowNo, "M_PriceList_Version_ID", priceListVersion.get_ID())
}
""
}

Expand Down

0 comments on commit 292400e

Please sign in to comment.