Copying a sales line to new line, serialised
Currently writing a plugin which will be copying (or really just adding) a sales order line for what would most typically be serialised stock.
Just the quantities will be different but it's essential the new line comes from the same SOH line, i.e the same batch/serialNo.
Currently I have
but the batch selection screen comes up when I don't want it to. I just want it to automatically add a new line, same partno, same SOHID as the source line.
I want to be able to set my own calculated quantity (worked out earlier in the plugin) but that's about it.
What's the trick for that?
I am holding the SOHID in case I need it from the source line. I know the below code would only be reliable if there is just 1 details line, but for now I am OK with that.
Just the quantities will be different but it's essential the new line comes from the same SOH line, i.e the same batch/serialNo.
Currently I have
- Code: Select all
object newKey = "";
salesOrder.SalesOrderLines.AddInventoryItem(soLine.InventoryID, JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrderLineCollection.SalesOrderLineInventorySeedTypes.e_SalesOrderLineInventoryID, ref newKey);
JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrderLine newsalesOrderLine = salesOrder.SalesOrderLines[(string)newKey];
newsalesOrderLine.UseSerials = false; //should this stop the batch selection dialog?
newsalesOrderLine.QuantityOrdered = newQty;
but the batch selection screen comes up when I don't want it to. I just want it to automatically add a new line, same partno, same SOHID as the source line.
I want to be able to set my own calculated quantity (worked out earlier in the plugin) but that's about it.
What's the trick for that?
I am holding the SOHID in case I need it from the source line. I know the below code would only be reliable if there is just 1 details line, but for now I am OK with that.
- Code: Select all
string SOHID = "";
foreach(JiwaFinancials.Jiwa.JiwaSales.SalesOrder.LineDetail soLineDetail in soLine.LineDetails)
{
SOHID = soLineDetail.SOHID;
}