Acumatica客户位置允许

Acumatica客户位置允许,acumatica,Acumatica,我有一个用户字段,在quoteMain.CopyQuoteFilter和OpportunityMaint.CopyQuoteFilter中存储业务帐户和位置。在屏幕布局上,我将AllowEdit=true。当用户点击铅笔时,它会打开供应商的位置,即使他们在销售部门工作。我有没有办法强迫它打开客户位置 这是我试图钻取到的位置Id的DAC [LocationID(typeof(Where<Location.bAccountID, Equal<Current<usrBAccountI

我有一个用户字段,在quoteMain.CopyQuoteFilter和OpportunityMaint.CopyQuoteFilter中存储业务帐户和位置。在屏幕布局上,我将AllowEdit=true。当用户点击铅笔时,它会打开供应商的位置,即使他们在销售部门工作。我有没有办法强迫它打开客户位置

这是我试图钻取到的位置Id的DAC

[LocationID(typeof(Where<Location.bAccountID, Equal<Current<usrBAccountId>>>),
        DisplayName = "Location",
        DescriptionField = typeof(Location.descr),
        BqlField = typeof(usrLocationID))] // typeof(Location.locationID))]
[PXDefault(typeof(Search<CROpportunity.locationID, Where<CROpportunity.opportunityID, Equal<Current<CRQuote.opportunityID>>>>), PersistingCheck = PXPersistingCheck.Nothing)]
public virtual int? UsrLocationID { get; set; }
public abstract class usrLocationID : PX.Data.BQL.BqlInt.Field<usrLocationID> { }

谢谢

您需要使用PXAction手动执行此操作。添加一个PXButton(可选)使用编辑图像或链接控件对其进行样式设置,然后添加一个事件处理程序,在其中创建目标图并重定向到它

下面是一个事件处理程序的示例,它重定向到许多图形处理位置DAC中的一个:

    public PXDBAction<BAccount> addLocation;
    [PXUIField(DisplayName = Messages.AddNewLocation)]
    [PXButton(ImageKey = PX.Web.UI.Sprite.Main.DataEntry)]
    public virtual void AddLocation()
    {
        var row = BAccount.Current;
        if (row == null || row.BAccountID == null) return;

        LocationMaint graph = null;
        switch (row.Type)
        {
            case BAccountType.VendorType:
                graph = PXGraph.CreateInstance<AP.VendorLocationMaint>();
                break;
            case BAccountType.CustomerType:
                graph = PXGraph.CreateInstance<AR.CustomerLocationMaint>();
                break;
            default:
                graph = PXGraph.CreateInstance<LocationMaint>();
                break;
        }


        var newLocation = (Location)graph.Location.Cache.CreateInstance();
        newLocation.BAccountID = row.BAccountID;
        var locType = LocTypeList.CustomerLoc;
        switch (row.Type)
        {
            case BAccountType.VendorType:
                locType = LocTypeList.VendorLoc;
                break;
            case BAccountType.CombinedType:
                locType = LocTypeList.CombinedLoc;
                break;
        }
        newLocation.LocType = locType;
        graph.Location.Insert(newLocation);
        PXRedirectHelper.TryRedirect(graph, PXRedirectHelper.WindowMode.NewWindow);

    }
发生此问题的原因是位置DAC有许多PXPrimaryGraph,并且在运行时它不知道在您的上下文中使用哪一个,因此它会从列表中的第一个位置回退

[PXCacheName("Location")]
[PXPrimaryGraph(new[] { typeof(VendorLocationMaint), 
                        typeof(CustomerLocationMaint), 
                        typeof(BranchMaint), 
                        typeof(EmployeeMaint), 
                        typeof(LocationMaint) }, 
                new[] { typeof(Select<Location, Where<bAccountID, Equal<Current<bAccountID>>, And<locationID, Equal<Current<locationID>>, And<Where<Current<locType>, Equal<LocTypeList.vendorLoc>, Or<Current<locType>, Equal<LocTypeList.combinedLoc>>>>>>>), 
                        typeof(Select<Location, Where<bAccountID, Equal<Current<bAccountID>>, And<locationID, Equal<Current<locationID>>, And<Where<Current<locType>, Equal<LocTypeList.customerLoc>, Or<Current<locType>, Equal<LocTypeList.combinedLoc>>>>>>>), 
                        typeof(Select2<Branch, InnerJoin<BAccount, On<BAccount.bAccountID, Equal<Branch.bAccountID>>, InnerJoin<Location, On<bAccountID, Equal<BAccount.bAccountID>, And<locationID, Equal<BAccount.defLocationID>>>>>, Where<bAccountID, Equal<Current<bAccountID>>, And<locationID, Equal<Current<locationID>>, And<Current<locType>, Equal<LocTypeList.companyLoc>>>>>), 
                        typeof(Select2<EPEmployee, InnerJoin<Location, On<bAccountID, Equal<EPEmployee.bAccountID>, And<locationID, Equal<EPEmployee.defLocationID>>>>, Where<bAccountID, Equal<Current<bAccountID>>, And<locationID, Equal<Current<locationID>>, And<Current<locType>, Equal<LocTypeList.employeeLoc>>>>>), 
                        typeof(Select<Location, Where<bAccountID, Equal<Current<bAccountID>>, And<locationID, Equal<Current<locationID>>>>>) })]
[PXProjection(typeof(Select2<Location, LeftJoin<LocationAPAccountSub, On<LocationAPAccountSub.bAccountID, Equal<bAccountID>, And<LocationAPAccountSub.locationID, Equal<vAPAccountLocationID>>>, LeftJoin<LocationARAccountSub, On<LocationARAccountSub.bAccountID, Equal<bAccountID>, And<LocationARAccountSub.locationID, Equal<cARAccountLocationID>>>, LeftJoin<LocationAPPaymentInfo, On<LocationAPPaymentInfo.bAccountID, Equal<bAccountID>, And<LocationAPPaymentInfo.locationID, Equal<vPaymentInfoLocationID>>>, LeftJoin<BAccountR, On<BAccountR.bAccountID, Equal<bAccountID>>>>>>>), Persistent = true)]
public class Location : IBqlTable, IPaymentTypeDetailMaster, ILocation
{
}

PO和SO页面重定向到相应的供应商/客户位置页面。它在您的场景中也应该是可行的。请分享新字段的DAC扩展定义谢谢你的回复Fernando,我已经更新了我的帖子,将DAC包含在用户字段中。这正是我所怀疑的。我还没有尝试过这个,但我想我可以尝试将它设置为一种CustomerLocation类型,看看是否可行。我会告诉你进展如何。我成功地测试了手动重定向。不确定设置当前上下文是否可行,但值得一试:Base.Caches[typeofLocation].current.LocType=LocTypeList.CustomerLoc或Base.Caches[typeofLocation].current.LocType=LocTypeList.CombinedLocals必须对其进行一些修改以满足我的需要,但这是可行的-感谢您的帮助!