Browse Source

Fixing some dumb link stuff

Kenric Nugteren 7 months ago
parent
commit
df1db0b540

+ 20 - 2
prs.classes/Entities/Bill/BillLine.cs

@@ -1,4 +1,5 @@
 using System;
+using System.Collections.Generic;
 using System.Linq;
 using InABox.Core;
 
@@ -6,15 +7,32 @@ namespace Comal.Classes
 {
     public class BillLineLink : EntityLink<BillLine>
     {
-        [NullEditor]
+        [PopupEditor(typeof(BillLine))]
         public override Guid ID { get; set; }
         
         [RequiredColumn]
         public BillLink BillLink { get; set; }
     }
 
+    internal class BillLineLookups : EntityLookup<BillLine>
+    {
+        public override Filter<BillLine>? DefineFilter() => null;
+
+        public override SortOrder<BillLine>? DefineSortOrder() => null;
+
+        public override Columns<BillLine> DefineColumns()
+        {
+            return base.DefineColumns().Add(x => x.BillLink.Number).Add(x => x.Description);
+        }
+
+        public override string FormatLookup(Dictionary<string, object?> values, IEnumerable<string> exclude)
+        {
+            return base.FormatLookup(values, exclude);
+        }
+    }
+
     [UserTracking(typeof(Bill))]
-    public class BillLine : Entity, IPersistent, IRemotable, IOneToMany<Bill>, ITaxable, ILicense<AccountsPayableLicense>, IPostableFragment<Bill>
+    public class BillLine : Entity, IPersistent, IRemotable, IOneToMany<Bill>, ITaxable, ILicense<AccountsPayableLicense>, IPostableFragment<Bill>, IEntityLookup<BillLine, BillLineLookups>
     {
         [RequiredColumn]
         [EntityRelationship(DeleteAction.Cascade)]

+ 2 - 2
prs.classes/Entities/Consignment/Consignment.cs

@@ -136,8 +136,8 @@ namespace Comal.Classes
         [IntegerEditor(Visible = Visible.Optional, Editable = Editable.Hidden)]
         [Aggregate(typeof(ConsignmentUnreceivedItems))]
         public int UnreceivedItems { get; set; }
-        
-        [NullEditor]
+
+        [Editable(Editable.Disabled)]
         [EntityRelationship(DeleteAction.SetNull)]
         public BillLineLink BillLine { get; set; }
         

+ 2 - 1
prs.classes/Entities/PurchaseOrder/PurchaseOrderItem.cs

@@ -118,7 +118,8 @@ namespace Comal.Classes
         
         [CurrencyEditor(Visible = Visible.Optional, Editable = Editable.Hidden, Summary = Summary.Sum)]
         public double Balance { get; set; }
-        
+
+        [Editable(Editable.Disabled)]
         [EntityRelationship(DeleteAction.SetNull)]
         public BillLineLink BillLine { get; set; }
 

+ 0 - 7
prs.desktop/Panels/Products/Locations/ProductStockMovementGrid.cs

@@ -228,13 +228,6 @@ public class ProductStockMovementGrid : DynamicDataGrid<StockMovement>, IDataMod
         return result;
     }
 
-    protected override BaseEditor? GetEditor(object item, DynamicGridColumn column)
-    {
-        if (column.ColumnName.Equals("Location.ID"))
-            return new NullEditor();
-        return base.GetEditor(item, column);
-    }
-
     public override void DeleteItems(params CoreRow[] rows)
     {
         if (!rows.Any())