Project

General

Profile

Edit Copy Actions

Support #12264

open

Support #12257: Vendor Management flow Issues

Missing Accounting Fields in Vendor Schema (Mongoose Strict Mode Risk)

Added by Yalavarthi Thriveni 8 days ago. Updated 5 days ago.

Status:
Resolved
Priority:
Normal
Target version:
-
Start date:
11/20/2026
Due date:
11/23/2026 (5 days late)
% Done:

100%

Estimated time:

Description

Code Location: Vendors.js

What is happening in code: The invoice and return controllers actively write and update fields like:

outstandingBalance
creditBalance
totalPurchases
lastPurchaseDate
totalReturnsValue
None of these fields are declared in the Mongoose schema Vendors.js.

Real-Life Example:
A developer or query runs Vendor.create(...) or Vendor.find().select(...) using standard Mongoose queries.
Because Mongoose operates in strict mode by default, it silently ignores or strips any field not defined in the schema.
Business Impact: Accounting balances randomly disappear, fail to show up in API responses, or are lost when a vendor profile is edited and saved from the UI.

Simple Fix: Explicitly declare these fields in Vendors.js:
outstandingBalance: { type: Number, default: 0 },
creditBalance: { type: Number, default: 0 },
totalPurchases: { type: Number, default: 0 },
lastPurchaseDate: { type: Date, default: null },
totalReturnsValue: { type: Number, default: 0 }


Add

Subtasks


Add

Related issues

Actions #1

Updated by Divya Inapakurthi 5 days ago

  • Due date set to 11/23/2026
  • Status changed from New to Resolved
  • Assignee set to Divya Inapakurthi
  • % Done changed from 0 to 100
Edit Copy Actions

Also available in: Atom PDF