Skip to main content
Answer

How to create shortcuts to Create Blanket Sales order

  • June 20, 2023
  • 2 replies
  • 95 views

variuxDavidE
Varsity I
Forum|alt.badge.img

How do I create a shortcuts for Create Blanket Sales Order on the Sales Order Menu and on the Customers three dots menu? I’m trying to easily go from creating a customer to creating a blanket sales order in a single click. 

 

Best answer by Vignesh Ponnusamy

@variuxdavid, You can try something like below, in the graph extension create an action and set the OrderType to BL as required. 

 

	public class CustomerMaint_Extension : PXGraphExtension<PX.Objects.AR.CustomerMaint>
{
#region Event Handlers
public PXAction<Customer> newBlanketSalesOrder;
[PXUIField(DisplayName = "Create Blanket Sales Order", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select)]
[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);
}

throw new PXRedirectRequiredException(soEntry, "SOOrderEntry");
}
return adapter.Get();
}
#endregion
}

Hope that helps. Feel free to post if you have any questions. Good Luck.!

2 replies

Vignesh Ponnusamy
Acumatica Moderator
Forum|alt.badge.img+5

@variuxdavid, You can try something like below, in the graph extension create an action and set the OrderType to BL as required. 

 

	public class CustomerMaint_Extension : PXGraphExtension<PX.Objects.AR.CustomerMaint>
{
#region Event Handlers
public PXAction<Customer> newBlanketSalesOrder;
[PXUIField(DisplayName = "Create Blanket Sales Order", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select)]
[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);
}

throw new PXRedirectRequiredException(soEntry, "SOOrderEntry");
}
return adapter.Get();
}
#endregion
}

Hope that helps. Feel free to post if you have any questions. Good Luck.!


variuxDavidE
Varsity I
Forum|alt.badge.img
  • Author
  • Varsity I
  • June 28, 2023

@Vignesh Ponnusamy Originally, I thought this was working. However, as I started testing the process today I found out that the Order Type does not seem to actually be triggering the Blanket settings. It seems to be creating a standard order but with the Blanket Order type. Instead of being able to create Child Orders I am only able to create Shipments.