Fix account dropdowns: vendor auto-select + sub-type filtering
Inventory vendor auto-select: match the dropdown off the Manufacturer field (almost always populated and equal to the vendor for the shop's distributors) instead of the AI's price-conditional vendorName, which was only returned when a price was scraped. Centralizes the logic in a shared inventory-vendor-match.js used by catalog lookup, AI lookup, label scan, and manual entry; skips brands sold by multiple distributors (PPG, KP Pigments) so those stay manual. Account dropdowns filtered by sub-type now filter by parent AccountType, so accounts a company classifies under a non-standard sub-type still appear: Inventory account (Asset), AP account (Liability), pay-from/bank and Bank Reconciliation pickers (Asset + Liability). Deposit account is now a user-selectable dropdown on the Job and Quote deposit modals (Asset + Liability accounts) instead of a silent auto-pick of the first Checking/Cash account; falls back to the old behavior when left blank, and validates the chosen account belongs to the company. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -452,12 +452,12 @@ public class BillsController : Controller
|
||||
var dto = _mapper.Map<BillDto>(bill);
|
||||
|
||||
// Payment form defaults
|
||||
// Payment sources: filter by parent AccountType (Asset or Liability), not sub-type,
|
||||
// so accounts a company classified under a different sub-type still appear.
|
||||
var bankAccounts = (await _unitOfWork.Accounts.FindAsync(
|
||||
a => a.CompanyId == bill.CompanyId &&
|
||||
(a.AccountSubType == AccountSubType.Cash ||
|
||||
a.AccountSubType == AccountSubType.Checking ||
|
||||
a.AccountSubType == AccountSubType.Savings ||
|
||||
a.AccountSubType == AccountSubType.CreditCard)))
|
||||
(a.AccountType == AccountType.Asset ||
|
||||
a.AccountType == AccountType.Liability)))
|
||||
.OrderBy(a => a.AccountNumber)
|
||||
.ToList();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user