I'm not sure if this is a bug or not (coz the code remains the same from AX4 to AX 2012)
The thing is when I want to register a journal, at some point, updateDimReservePhysical is called, and this code is there. The code in red is where I have the problem.
if (_inventRefTransId)
{
select forceplaceholders forupdate inventTransIssue
index hint TransIdIdx
where inventTransIssue.ItemId == movement.itemId() &&
inventTransIssue.ValueOpen == InventTransOpen::Yes &&
inventTransIssue.StatusReceipt == StatusReceipt::None &&
inventTransIssue.StatusIssue == StatusIssue::ReservOrdered &&
inventTransIssue.InventTransId == _inventRefTransId &&
inventTransIssue.InventRefTransId == movement.transId()
#inventDimExistsJoin(inventTransIssue.InventDimId,inventDim,inventDimCriteria,inventDimParm);
}
else
{
select forceplaceholders forupdate inventTransIssue
order by DateStatus
where inventTransIssue.ItemId == movement.itemId() &&
inventTransIssue.ValueOpen == InventTransOpen::Yes &&
inventTransIssue.StatusReceipt == StatusReceipt::None &&
inventTransIssue.StatusIssue == StatusIssue::ReservOrdered &&
//I have changed != for ==
inventTransIssue.InventTransId == movement.transId() &&
//inventTransIssue.InventTransId != movement.transId() &&
inventTransIssue.InventRefTransId == ''
#inventDimExistsJoin(inventTransIssue.InventDimId,inventDim,inventDimCriteria,inventDimParm);
}
If I leave != I get an error. Debugging, I see that InventtransIssue gets mapped to a JournalTrans of type Sales. However, my actual Journal is Transfer type, so this makes no sense for me. Why would the code just search for a random transaction that has nothing to do with my Journal??
Changing it from != to == the error was solved, but I don't know if this may cause problems in any other proccess.
Any thoughts??
Thanks!