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
- remove extra space (sider)
- PR: Bring rejected qty in grid view
- PI: Rename `Stock Qty` to `Accepted Qty in Stock UOM`
- PI: Move `Accepted Qty in Stock UOM` under Stock UOM
Negative stock can be toggled back after queuing transactions, this
causes failure when repost is executed.
Now allow_negative_stock stock is set at time of queuing the repost job.
This means setting changes done afterwards won't affect already
submitted reposts.
- Fixed transferred qty not back updating on JC if partial transfer
- Partial transfer not mapping pending qty from JC correctly in SE
- tests for above cases
- minor code cleanup
* fix: auto update price list rate
* fix: hide field when auto insert isn't enabled
(cherry picked from commit bb3957eba35a5204a1a01e412dee596532bd525e)
Co-authored-by: Sagar Sharma <63660334+s-aga-r@users.noreply.github.com>
[skip ci]
* fix: Bulk update of valid upto field wasn't working
Check in dates for the price list was failing because valid_upto field was string. Converting to date fixed the problem.
* chore: extend fix and cleanup whitespace
Co-authored-by: Ankush Menat <ankush@frappe.io>
(cherry picked from commit 95a5ef1d416d54ecf0f557586b341b0dce2a0b05)
Co-authored-by: fatihustaoglu <46131068+fatihustaoglu@users.noreply.github.com>
- Check if items pulled in stock entry are present in Job Card
- Code cleanup and removed redundant checks
Co-authored-by: Gavin D'souza <gavin18d@gmail.com>
Item merge creates a repost and depending on number of entries it can
take from 1 to n hours for it to finish. (depending upon queued up
reposts)
Added message so users don't feel confused till this operation is
finished.
If company is not supplied and valuation rate is 0, then default
company is used for checking if perpetual inventory is enabled or not.
This makes little sense as different companies can have different
setting for perpetual inventory.
* perf: skip get_pricing_rules if no pricing rule exists
* perf: fetch mode of payments data in single query
* perf: get total company stock only for purchase order
* perf: skip insertion of stock ledger entry
* fix: undo changes to allow negative stock flag
* fix: sider
Co-authored-by: Ankush Menat <ankushmenat@gmail.com>
Co-authored-by: Ankush Menat <ankush@iwebnotes.com>
* refactor: shows opening balance from filtered from_date
* refactor: opening balance considered from filtered from_date in stock ledger
* fix: check if stock reco is opening and misc cleanups
voucher_detail_no is supposed to have an index, it was added on
on_doctype_update function of table, however this function is only
called if DocType itself is updated and `on_update` is called on
DocType. Stock ledger Entry doctype hasn't changed since addition of
this index in function.
Before: Lack of this index was causing full table scan in
get_future_sle_to_fix function. (~50 seconds in a reposting job)
After: Single row is fetched (~0.5 second in full reposting job)
Learnings:
1. Add simple indexes via doctype only
2. For complex indexes always change doctype.json file for it to take
effect.
* fix: using DN for transfer w/o internal customer (backport #27798) (#27805)
* fix: using DN for transfer w/o internal customer (#27798)
This used to be work before though not "advertised", since a lot of
users have started using it as feature, it can't be broken now.
(cherry picked from commit df1f8fddf6e2f4106c1a2778614ba9a1dc5ff67e)
* fix(ux): use toast instead of popup
Co-authored-by: Ankush Menat <ankush@iwebnotes.com>
(cherry picked from commit fa944382c53bdeeb92f2dcc876e2c11ed03e20cc)
# Conflicts:
# erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
* fix: resolve conflict
* fix: resolve conflicts
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Ankush Menat <ankush@iwebnotes.com>
* refactor: remove unnecessary list comprehensions
* fix: correct cost distribution logic
While apportioning costs same condition should be present on both sides
so total value is representative of all items to be apportioned.
Here while calculating incoming_items_cost only FG items are considered,
but while apportioning all items with to_warehouse are considered.
Solution: only apportion additional cost on FG items
* test: test cost distribution
* fix: patch for additional cost
fix(patch): consider PCV while patching
- consider Period closing voucher while patching
- recomute rates for SLE of affected stock entries
consider only FG/scrap item SLEs for recomputation of rates
* fix: remove client side logic for addn cost
All of this is done in python code hence removed client side code.
* fix: no validation on item defaults
* fix: cache value while validating
* test: item default company relation
* fix: reorder validations
* refactor: add guard conditions on update_defaults
* test: add default warehouse for item group
* fix: validate item defaults for item groups
Co-authored-by: Ankush Menat <ankush@iwebnotes.com>
* fix: Validate if item exists on uploading items in stock reco
- Uploading non existent item in stock reco and then changing warehouse or batch gave an error
- Check for non existent item
* chore: translation
Co-authored-by: Ankush Menat <ankushmenat@gmail.com>
* test: automated test for running all stock reports
These test do not assert correctness, they just check that "execute" function
is working with sane filters.
* test: make report execution test modular