Add vendor supply categories with inventory auto-filter
Vendors can now be tagged with one or more inventory categories (Powder, Chemical, etc.) via checkboxes on the Create/Edit form. The inventory Create/Edit vendor dropdown automatically filters to matching vendors when a category is selected; falls back to all vendors if none are tagged. Includes migration AddVendorCategories (VendorInventoryCategories join table). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -809,6 +809,15 @@ modelBuilder.Entity<ReworkRecord>().HasQueryFilter(e =>
|
||||
.HasForeignKey(s => s.DefaultExpenseAccountId)
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
// Vendor ↔ InventoryCategoryLookup (many-to-many supply categories)
|
||||
modelBuilder.Entity<Vendor>()
|
||||
.HasMany(v => v.Categories)
|
||||
.WithMany(c => c.Vendors)
|
||||
.UsingEntity<Dictionary<string, object>>(
|
||||
"VendorInventoryCategories",
|
||||
j => j.HasOne<InventoryCategoryLookup>().WithMany().HasForeignKey("InventoryCategoryLookupId"),
|
||||
j => j.HasOne<Vendor>().WithMany().HasForeignKey("VendorId"));
|
||||
|
||||
// Bill → APAccount (no cascade to avoid cycles)
|
||||
modelBuilder.Entity<Bill>()
|
||||
.HasOne(b => b.APAccount)
|
||||
|
||||
Reference in New Issue
Block a user