Вам нужно будет сделать это вручную с помощью PXAction. Добавьте кнопку PXButton (при желании добавьте к ней стиль редактирования изображения) или элемент управления ссылкой, затем добавьте обработчик событий, в котором вы создадите целевой граф и перенаправите его.
Вот пример обработчика событий, который перенаправляет на один из множества обработчиков графиков. Местоположение DA C:
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);
}
Проблема возникает из-за того, что в местоположении DA C имеется много 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
{
}