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>
- Hide MR/Material Transfer buttons in JC if cancelled
- Show MR/Material transfer buttons if pending to transfer or excess transfer allowed
- Renamed ‘Transferred Qty’ to ‘FG Qty from Transferred Raw Materials’ in JC
- Set status to Completed in JC in case of excess transfer too
- During excess transfer against JC, avoid negative ‘For Quantity’. Set to 0 instead
- Job card section and excess transfer allowance checkbox in Manufacturing Settings
- Renamed ’Allow Multiple Material Consumption’ to ‘Allow Continuous Material Consumption’ (fiedname is same)
- Secured denominator variables in `get_transfered_raw_materials` to avoid ZeroDivisionError
* chore: remove deprecated and empty QUnit tests
* ci: fix UI test config
Testing library was added on Frappe, in order to reuse command testing
library has to be installed during setup process.
* test: negative stock validation on SR cancel
* fix: negative stock setting ignored in stock reco
In stock reconcilation cancellation negative stock setting is ignored as
`db.get_value` is returning string `'0'` which is not casted to int/bool
for further logic. This causes negative qty, which evantually gets
caught by reposting but by design this should stop cancellation.
* test: typo and minor refactor