Hello,
I am trying to build a customization where I want to make the Unit Price (CuryUnitPrice) column on SOLine editable even when the Sales Order is in the Completed state.
I have been able to make the field editable, and after updating the value, the Save button is also available to save the updated changes.
However, when I click the Save button and try to save the updated value, I am getting the following error:

Here is my code for the Graph Extension as well as the Workflow Extension.
Workflow Extension:
public class SOOrderEntry_Workflow_Ext : PXGraphExtension<PX.Objects.SO.SOOrderEntry_Workflow, SOOrderEntry>
{
public static bool IsActive() => true;
public override void Configure(PXScreenConfiguration config) =>
Configure(config.GetScreenConfigurationContext<SOOrderEntry, SOOrder>());
protected virtual void Configure(WorkflowContext<SOOrderEntry, SOOrder> context)
{
context.UpdateScreenConfigurationFor(screen =>
screen.WithFlows(flows =>
flows.Update<SOBehavior.sO>(flow =>
flow.WithFlowStates(states =>
states.Update<SOOrderStatus.completed>(state =>
state
.WithActions(acts =>
{
acts.Add(g => g.Save);
acts.Add(g => g.Cancel);
})
.WithFieldStates(fields =>
{
fields.RemoveField<SOLine.curyUnitPrice>();
fields.AddField<SOLine.curyUnitPrice>();
})
)
)
)
)
);
}
}
Graph Extension:
protected virtual void _(Events.RowSelected<SOLine> e, PXRowSelected baseHandler)
{
baseHandler?.Invoke(e.Cache, e.Args);
var line = e.Row;
if (line == null) return;
var order = Base.Document.Current;
bool allowInCompleted = CanEdit(order, line);
if (!allowInCompleted)
return;
Base.Document.Cache.AllowUpdate = true;
Base.Transactions.Cache.AllowUpdate = true;
PXUIFieldAttribute.SetEnabled<SOLine.curyUnitPrice>(e.Cache, line, true);
if (line.ManualPrice != true)
e.Cache.SetValueExt<SOLine.manualPrice>(line, true);
}
protected virtual void _(Events.RowSelected<SOOrder> e, PXRowSelected baseHandler)
{
baseHandler?.Invoke(e.Cache, e.Args);
var doc = e.Row;
if (doc == null) return;
bool completed = string.Equals(doc.Status, SOOrderStatus.Completed, StringComparison.OrdinalIgnoreCase);
if (!completed) return;
Base.Document.Cache.AllowUpdate = true;
Base.Transactions.Cache.AllowUpdate = true;
Base.Actions[nameof(SOOrderEntry.Save)]?.SetEnabled(true);
Base.Actions[nameof(SOOrderEntry.Cancel)]?.SetEnabled(true);
}
If anyone could help me with this, it would be really helpful.
Kind Regards,
Dhruv