单击自定义操作按钮时在 Acumatica 屏幕中启用保存按钮
Enable Save Button in Acumatica Screen upon Custom Action Button Click
我在网格工具栏 "Mark All For PO" 中创建了一个自定义操作按钮,它标记了销售订单屏幕 (SO301000) 中网格列 "Mark For PO" 的所有复选框。
点击我的自定义按钮后,销售订单屏幕左上角的保存按钮未启用,无法保存更改。请帮助我继续我的工作
这是我的图表代码......
public PXAction<SOOrder> markAllForPO;
[PXButton(CommitChanges = true)]
[PXUIField(DisplayName = "Mark All For PO", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select)]
public virtual IEnumerable MarkAllForPO(PXAdapter adapter)
{
foreach (SOLine tran in Base.Transactions.Select())
{
if (tran.POCreate == true)
{
tran.POCreate = false;
tran.POSource = "";
}
else
{
tran.POCreate = true;
tran.POSource = INReplenishmentSource.PurchaseToOrder;
}
}
return adapter.Get();
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Following are the supporting images for the question
[1][SO301000=>Sales Order Screen]
[2][DataSource Property of the Action Button from Customization Editor]
[3][Grid Action bar Property of the Action Button]
[1]: https://i.stack.imgur.com/oCAzi.png
[2]: https://i.stack.imgur.com/1JKBX.png
[3]: https://i.stack.imgur.com/Jmvjt.png
你快到了!
赋值后,需要调用Update()方法让缓存知道记录有新版本
public class SOOrderEntry_Extension : PXGraphExtension<SOOrderEntry>
{
public PXAction<SOOrder> markAllForPO;
[PXButton(CommitChanges = true)]
[PXUIField(DisplayName = "Mark All For PO", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select)]
public virtual IEnumerable MarkAllForPO(PXAdapter adapter)
{
foreach (SOLine tran in Base.Transactions.Select())
{
if (tran.POCreate == true)
{
tran.POCreate = false;
tran.POSource = "";
}
else
{
tran.POCreate = true;
tran.POSource = INReplenishmentSource.PurchaseToOrder;
}
Base.Transactions.Update(tran); //Cache is updated
}
return adapter.Get();
}
}
我在网格工具栏 "Mark All For PO" 中创建了一个自定义操作按钮,它标记了销售订单屏幕 (SO301000) 中网格列 "Mark For PO" 的所有复选框。
点击我的自定义按钮后,销售订单屏幕左上角的保存按钮未启用,无法保存更改。请帮助我继续我的工作
这是我的图表代码......
public PXAction<SOOrder> markAllForPO;
[PXButton(CommitChanges = true)]
[PXUIField(DisplayName = "Mark All For PO", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select)]
public virtual IEnumerable MarkAllForPO(PXAdapter adapter)
{
foreach (SOLine tran in Base.Transactions.Select())
{
if (tran.POCreate == true)
{
tran.POCreate = false;
tran.POSource = "";
}
else
{
tran.POCreate = true;
tran.POSource = INReplenishmentSource.PurchaseToOrder;
}
}
return adapter.Get();
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Following are the supporting images for the question
[1][SO301000=>Sales Order Screen]
[2][DataSource Property of the Action Button from Customization Editor]
[3][Grid Action bar Property of the Action Button]
[1]: https://i.stack.imgur.com/oCAzi.png
[2]: https://i.stack.imgur.com/1JKBX.png
[3]: https://i.stack.imgur.com/Jmvjt.png
你快到了!
赋值后,需要调用Update()方法让缓存知道记录有新版本
public class SOOrderEntry_Extension : PXGraphExtension<SOOrderEntry>
{
public PXAction<SOOrder> markAllForPO;
[PXButton(CommitChanges = true)]
[PXUIField(DisplayName = "Mark All For PO", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select)]
public virtual IEnumerable MarkAllForPO(PXAdapter adapter)
{
foreach (SOLine tran in Base.Transactions.Select())
{
if (tran.POCreate == true)
{
tran.POCreate = false;
tran.POSource = "";
}
else
{
tran.POCreate = true;
tran.POSource = INReplenishmentSource.PurchaseToOrder;
}
Base.Transactions.Update(tran); //Cache is updated
}
return adapter.Get();
}
}