fix: validate docs in closed accounting period on save (#36157)
(cherry picked from commit 5985e02574e387ef92a2bf0a9d2d1b49ad57cdd3)
Co-authored-by: Anand Baburajan <anandbaburajan@gmail.com>
* refactor: new type for JE - Exchange Gain or Loss
* refactor: skip few validations for Exchanage Gain Or Loss type Jour
* refactor: ERR create 2 journals for handling zero and non-zero compa
1. Additional check box accounts table to identify accounts with zero balance
2. Accounts with zero balance only in either of the 2 currencies will be handled on separate Journal
* refactor: skips few validation for allowing 0 debit/credit
* fix: General Ledger presentaion currency
* test: fix test case in general ledger
* test: fix failing test case in AR report
* perf: only validate if voucher is journal entry
* perf: optimize merge GLE
- Order fields such that comparison will fail faster
- Break out of loops if not matched
* perf: don't try to match SLE if count mismatch
* refactor: simplify initialize_previous_data
* perf: use cache for fetching valuation_method
These are set only once fields
* refactor: simplify get_future_stock_vouchers
* refactor: simplify get_voucherwise_gl_entries
* perf: fetch only required fields for GL comparison
`select *` fetches all fields, output of this function is only used for
comparing.
* perf: reorder conditions in PL cost center check
* perf: reduce query while validating new gle
* perf: use cache for validating warehouse props
These properties don't change often, no need to query everytime.
* perf: use cached stock settings to validate SLE
* docs: update misleading docstring
Co-authored-by: Marica <maricadsouza221197@gmail.com>
Opening GL entries can not be for profit and loss accounts. Round off
accounts are by default P&L account. Hence when making opening entry,
make round off entries as non-opening.
Related issue: ISS-20-21-09677
* fix: finished item validation and rate
* fix: Check if stock and account balance in sync after reposting
* fix: validate stock accounts in journal entry
* fix: validate expense against budget