When recording, a dedicated button should appear, but it doesn't because there's a warning on the screen. Can anyone help me resolve this?

Here is my action code
public PXAction<PX.Objects.AR.ARInvoice> LoadDocumentsPro;
[PXButton(CommitChanges = true)]
[PXUIField(DisplayName = "Load Documents")]
protected virtual void loadDocumentsPro()
{
}
Here is my code where I do the validation to show the action, it works when there is no warning, if there is the event does not work.
protected virtual void _(Events.RowSelected<ARInvoice> e)
{
var row = e.Row;
var cache = e.Cache;
if (row != null)
{
bool validacionPro = false;
bool validacionPro2 = false;
PXResultset<XTProformaInvoice> value_1 = this.proformaView.Select();
foreach (XTProformaInvoice item in value_1)
{
if (item.Loaded == false || item.Loaded == null) validacionPro = true;
}
if (validacionPro == true && value_1.Count >= 1)
{
Base.release.SetEnabled(false);
}
if (cache.GetStatus(row) == PXEntryStatus.Inserted) validacionPro2 = true;
if (validacionPro2 == true)
{
LoadDocumentsPro.SetVisible(false);
}
else
{
LoadDocumentsPro.SetVisible(true);
}
}
}
