Quantcast
Channel: Martin Dráb's Activities
Viewing all articles
Browse latest Browse all 17532

InventDimID gets replaced in SalesLine

$
0
0
Hi all,


I am trying to create a salesLine using following piece of code.

    SalesLine	salesLine;
	InventDim	inventDim;
	InventTable	inventTable;
	
	salesLine.clear();
	inventDim = null;
	salesLine.initValue();

	salesLine.SalesId = salesTable.SalesId;
	salesLine.initFromSalesTable(salesTable);

	salesLine.ItemId = '123';	
	
	inventTable = InventTable::find(salesLine.ItemId);
	salesLine.initFromInventTable(inventTable);
    
    inventDim.selectForUpdate(true);
    inventDim.InventLocationId  = "Value"; 
    inventDim.InventSiteId      ="Value";
    inventDim.inventBatchId="Value";
	
	salesLine.InventDimId = InventDim::findOrCreate(inventDim).InventDimId;

	salesLine.SalesQty =  1;

	salesLine.SalesPrice = 3200.00;
	
	salesLine.LineAmount = salesLine.calcLineAmount();
	
	salesLine.createLine(true,true,false,true);


But the problem I am facing is that InventDimID in SalesLine gets replaced after "creatLine". InventDimID "before creatLine" is the one that has InventBatchID, but InventDimID "after createLine" is the one that does not have InventBatchID.

How can I prevent this from happening ? I want the inventDimID that has InventBatchID value.

Viewing all articles
Browse latest Browse all 17532

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>