Hello everyone,
Thanks to @Keith Richardson @Samvel Petrosov and some others.
I removed the shipment flow state from the SO workflow with the Workflow API and added it back with an amended method to disable fields.
Original method:
public static void DisableWholeScreen(FieldState.IContainerFillerFields states)
{
states.AddTable<SOOrder>(state => state.IsDisabled());
states.AddTable<SOLine>(state => state.IsDisabled());
states.AddTable<SOTaxTran>(state => state.IsDisabled());
states.AddTable<SOBillingAddress>(state => state.IsDisabled());
states.AddTable<SOBillingContact>(state => state.IsDisabled());
states.AddTable<SOShippingAddress>(state => state.IsDisabled());
states.AddTable<SOShippingContact>(state => state.IsDisabled());
states.AddTable<SOLineSplit>(state => state.IsDisabled());
states.AddTable<CRRelation>(state => state.IsDisabled());
}
My method:
public static void EnableSOLine(FieldState.IContainerFillerFields states)
{
states.AddTable<SOOrder>(state => state.IsDisabled());
states.AddTable<SOTaxTran>(state => state.IsDisabled());
states.AddTable<SOBillingAddress>(state => state.IsDisabled());
states.AddTable<SOBillingContact>(state => state.IsDisabled());
states.AddTable<SOShippingAddress>(state => state.IsDisabled());
states.AddTable<SOShippingContact>(state => state.IsDisabled());
states.AddTable<CRRelation>(state => state.IsDisabled());
}
Below is what I did to remove and then add back the shipment stage to the SO workflow:
public sealed override void Configure(PXScreenConfiguration config)
{
Configure(config.GetScreenConfigurationContext<SOOrderEntry,
SOOrder>());
}
protected static void Configure(WorkflowContext<SOOrderEntry,
SOOrder> context)
{
context.UpdateScreenConfigurationFor(screen => screen
.WithFlows(flows =>
{
flows.Update<SOBehavior.sO>(flow => flow
.WithFlowStates(flowStates =>
{
flowStates.Remove<State.shipping>();
flowStates.Add<State.shipping>(flowState =>
{
return flowState
.WithActions(actions =>
{
actions.Add(g => g.createShipmentIssue);
actions.Add(g => g.emailSalesOrder);
actions.Add(g => g.createPurchaseOrder);
actions.Add<CreatePaymentExt>(e => e.createAndCapturePayment);
actions.Add<CreatePaymentExt>(e => e.createAndAuthorizePayment);
})
.WithEventHandlers(handlers =>
{
handlers.Add(g => g.OnShipmentUnlinked);
handlers.Add(g => g.OnShipmentConfirmed);
})
.WithFieldStates(EnableSOLine);
});
}));
}));
}
Hope this helps someone in the future!
Aleks