Solved

How to create shortcuts to Create Blanket Sales order

  • 20 June 2023
  • 2 replies
  • 72 views

Userlevel 2
Badge

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. 

 

icon

Best answer by Vignesh Ponnusamy 20 June 2023, 17:50

View original

2 replies

Userlevel 7
Badge +4

@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.!

Userlevel 2
Badge

@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.

 

 

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved