I have created a shortcut button for Create Blanket Sales Order on the Sales Order Menu and on the Customers three dots menu.

This feature is used to: from creating a customer to creating a blanket sales order in a single click.
However, I have a problem: when I click the "Create Blanket Sales Order" button, it goes to the Sales Orders page then I notice that the "Create Child Orders" button is not displayed.

Also it works properly if I select the order type manually.

Please help me see if I am wrong or missing any part of the code. Thank you everyone for your help.
Here is the code
----------------------------------------------------------------------------------------------------------
namespace PX.Objects.AR
{
[PXCacheName("SOOrder Extension")]
public class SOOrderExt : PXCacheExtension<SOOrder>
{
#region UsrCreateChildOrders
[PXBool]
[PXUIField(DisplayName = "Create Child Orders")]
public virtual bool? UsrCreateChildOrders { get; set; }
public abstract class usrCreateChildOrders : PX.Data.BQL.BqlBool.Field<usrCreateChildOrders> { }
#endregion
}
public class CustomerMaint_Extension : PXGraphExtension<CustomerMaint>
{
public PXAction<Customer> newBlanketSalesOrder;
[PXUIField(DisplayName = "Create Blanket Sales Order")]
[PXButton]
public virtual IEnumerable NewBlanketSalesOrder(PXAdapter adapter)
{
Customer customer = Base.BAccount.Current;
if (customer != null && customer.BAccountID > 0L)
{
SOOrderEntry soEntry = PXGraph.CreateInstance<SOOrderEntry>();
soEntry.Clear();
SOOrder newDoc = (SOOrder)soEntry.Document.Cache.Insert();
newDoc.BranchID = null;
soEntry.Document.Cache.SetValueExt<SOOrder.customerID>(newDoc, customer.BAccountID);
soEntry.Document.Cache.SetValueExt<SOOrder.orderType>(newDoc, "BL"); // Set SOOrder Type here
newDoc.ContactID = customer.PrimaryContactID < 0L ? null : customer.PrimaryContactID;
soEntry.customer.Current.CreditRule = customer.CreditRule;
if (soEntry.Document.Current.FreightTaxCategoryID != null)
{
SOOrder createdOrder = (SOOrder)soEntry.Document.Cache.CreateCopy(soEntry.Document.Current);
soEntry.Document.Current.FreightTaxCategoryID = null;
soEntry.Document.Update(createdOrder);
}
// Update the order type configuration check
var orderType = PXSelect<SOOrderType,
Where<SOOrderType.orderType, Equal<Required<SOOrderType.orderType>>>>.
Select(Base, "BL").FirstOrDefault();
if (orderType != null && orderType.GetItem<SOOrderType>().Behavior != "BL")
{
throw new PXException("The specified Order Type is not configured as a Blanket Order Type.");
}
throw new PXRedirectRequiredException(soEntry, "SO301000");
}
return adapter.Get();
}
}
}