mergify[bot] b9181e85dc
perf: new column Posting Datetime in SLE to optimize stock ledger related queries (backport #39800) (#40004)
* perf: new column posting datetime in SLE to optimize stock ledger related queries

(cherry picked from commit d80ca523a43e9d1073dc008ead7d140fb0811a89)

# Conflicts:
#	erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py

* test: test cases to test clash timestamp entries

(cherry picked from commit f04676aaed69d669e43099077c85d93fedbf7e07)

* chore: remove microsecond from posting_datetime

(cherry picked from commit a73ba2c0d26b9d27bb5a75bc6c9739e49035f266)

* chore: fix conflicts

---------

Co-authored-by: Rohit Waghchaure <rohitw1991@gmail.com>
2024-02-21 21:14:28 +05:30
..
2024-01-11 13:27:13 +00:00

Accounts module contains masters and transactions to manage a traditional double entry accounting system.

Accounting heads are called "Accounts" and they can be groups in a tree like "Chart of Accounts"

Entries are:

  • Journal Entries
  • Sales Invoice (Itemised)
  • Purchase Invoice (Itemised)

All accounting entries are stored in the General Ledger

Payment Ledger

Transactions on Receivable and Payable Account types will also be stored in Payment Ledger. This is so that payment reconciliation process only requires update on this ledger.

Key Fields

Field Description
account_type Receivable/Payable
account Accounting head
party Party Name
voucher_no Voucher No
against_voucher_no Linked voucher(secondary effect)
amount can be +ve/-ve

Design

debit and credit have been replaced with account_type and amount. against_voucher_no is populated for all entries. So, outstanding amount can be calculated by summing up amount only using against_voucher_no.

Ex:

  1. Consider an invoice for ₹100 and a partial payment of ₹80 against that invoice. Payment Ledger will have following entries.
voucher_no against_voucher_no amount
SINV-01 SINV-01 100
PAY-01 SINV-01 -80
  1. Reconcile a Credit Note against an invoice using a Journal Entry

An invoice for ₹100 partially reconciled against a credit of ₹70 using a Journal Entry. Payment Ledger will have the following entries.

voucher_no against_voucher_no amount
SINV-01 SINV-01 100
CR-NOTE-01 CR-NOTE-01 -70
JE-01 CR-NOTE-01 +70
JE-01 SINV-01 -70