Add company default GL accounts; move QB sign-fix to platform
Default accounts: companies can now set a default Revenue, COGS, and Inventory account (Chart of Accounts -> "Default Accounts" card). Stored on CompanyPreferences (3 nullable FKs + migration). Used as the fallback when an item or invoice line leaves its account blank: - Invoice lines fall back to the default Revenue account, then to 4000. - New inventory/catalog items are pre-filled with the COGS/Inventory defaults, so the value is stored on the item and both live posting and the balance-recompute path stay consistent. Blank defaults = unchanged behavior, so nothing changes until a company opts in. Setting both COGS + Inventory enables perpetual-inventory COGS posting (warned in the UI and help docs). Help KB + Settings article updated. Also moves the "Fix QB Import Signs" tool off the company Chart of Accounts page (was CompanyAdmin-visible) to the SuperAdmin-only platform Company Details page, operating on the target company. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -275,10 +275,18 @@ public class InventoryController : Controller
|
||||
ViewBag.UseMetric = useMetric;
|
||||
ViewBag.CoverageUnit = _measurementService.GetCoverageUnitLabel(useMetric);
|
||||
|
||||
// Pre-fill the GL account dropdowns from the company's configured defaults so new items
|
||||
// inherit them (the user can still change or clear them on the form).
|
||||
var companyId = _tenantContext.GetCurrentCompanyId() ?? 0;
|
||||
var prefs = await _unitOfWork.CompanyPreferences
|
||||
.FirstOrDefaultAsync(p => p.CompanyId == companyId && !p.IsDeleted);
|
||||
|
||||
return View(new CreateInventoryItemDto
|
||||
{
|
||||
CoverageSqFtPerLb = 30,
|
||||
TransferEfficiency = 65
|
||||
TransferEfficiency = 65,
|
||||
InventoryAccountId = prefs?.DefaultInventoryAccountId,
|
||||
CogsAccountId = prefs?.DefaultCogsAccountId
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user