I added a custom action to the Details grid of the Sales Quotes screen. It works as expected.
If the setup for my module is disabled, I am able to disable the button, but I cannot seem to hide it from view.
These are the ASPX changes to add the button.
(added to the top of the form:
<px:PXDSCallbackCommand Name="ResetPrice" Visible="false" CommitChanges="true" DependOnGrid="ProductsGrid" /></CallbackCommands>
Toolbar button added in the grid seciton:
<px:PXToolBarButton Text="Reset Price" Visible="False">
<AutoCallBack Target="ds" Command="ResetPrice">
<Behavior CommitChanges="True" /></AutoCallBack>
In the RowSelected, I check if my module is enabled. If it is not, I try to set the Visibility to false.
if (setup == null || (setup.EnablePricingMarkup == null || setup.EnablePricingMarkup == false) || (setup.UseQuotesOpportunities == null || setup.UseQuotesOpportunities == false))
{
PXUIFieldAttribute.SetVisible<CROpportunityProductsExt.usrCurrentCost>(cache, null, false);
PXUIFieldAttribute.SetVisible<CROpportunityProductsExt.usrQuoteCost>(cache, null, false);
ResetPrice.SetVisible(false);
ResetPrice.SetEnabled(false);
return;
}
ResetPrice.SetVisible(true);
ResetPrice.SetEnabled(true);
If my module is not enabled, it is being disabled, but it is still showing on the menu bar of the grid. Note that even when it is disabled, it is not greyed out.

If you click it when it is disabled you get a message on the screen.

In the project editor, I default Visible to False as well.

If my custom module is not being used, I want to hide this button.
Any ideas on what I am missing?
Edit: This is the definition of the Action in the graph extension in case I have something wrong there:
public PXAction<CROpportunityProducts> ResetPrice;
[PXButton(CommitChanges = true)]
[PXUIField(DisplayName = "Reset Price", Enabled = false, Visibility = PXUIVisibility.Invisible)]
protected void resetPrice()
{
CROpportunityProducts cR = Base.Products.Current;
if (cR == null) return;
CROpportunityProductsExt itemExt = PXCache<CROpportunityProducts>.GetExtension<CROpportunityProductsExt>(cR);
if (itemExt == null) return;
InventoryItemCurySettings inItem = SelectFrom<InventoryItemCurySettings>.Where<InventoryItemCurySettings.inventoryID.IsEqual<CROpportunityProducts.inventoryID.FromCurrent>>.View.Select(Base);
if (inItem == null) return;
cR.CuryUnitPrice = inItem.BasePrice;
cR.ManualPrice = false;
itemExt.UsrQuoteCost = 0;
Base.Products.UpdateCurrent();
}