* fix: misleading "Set Default X" fields after saving
* refactor: remove unncessary code and minor formatting
* fix: extend to more doctypes and correct fieldnames
Co-authored-by: Ankush Menat <ankush@frappe.io>
This check was only checking total sum, which is problamatic when making
backdated entries that can cause intermediate values to go negative
while overall values stay positive.
batch's ledger is only maintained in form of `actual_qty` on batch's
SLEs. To validate if batch has any negative qty in future, cumulative
total of `actual_qty` is required to ensure it never goes negative.
Using basic idea that repost with older posting date will also take care
of subsequent posting dates...
When Item-WH reposts are queued:
1. If another repost with same item-wh but older posting date exists
then skip current one.
2. If another repost with same item-wh but newer posting date exists
then skip another one.
Item-WH based reposting requires querying existing similar repost.
Assuming there is only 1 max extra entry with same params just indexing
item-WH is sufficient to speed up the query.
In current implementation selecting Item-Warehouse based reposting is
better for few users, who don't use depenent SLEs but have frequent
transactions involving same items.
This change lets them switch to item-warehouse based reposting if
required.
Only use this if you understand technicalities of stock reposting. This
is experimental but will become mainstream in coming days.
If user reached this code then they already have permission to create
stock transaction, hence ignore permission checks while
creating/cancelling repost item valuation entries.
- Fix Server side PR test
- linter: re-arrange imports
- sider: avoid single line multi statement
- Code cleanup: Improve code readability and avoid horizontal scroll in test_purchase_receipt
- Removed unused variables in test_purchase_receipt