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
* fix: Maintain same rate in Stock Ledger until stock become positive
* fix: Maintain same rate in Stock Ledger until stock become positive
(cherry picked from commit 10754831c33b3459d5a45c98f875afa48a444627)
Co-authored-by: Nabin Hait <nabinhait@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
* fix(ux): apply proper filtering in stock reports
Stock Balance: apply company filter to warehouse field
Stock Ageing: apply company filter to warehouse field
* fix: unnecessary parens
Co-authored-by: Alan <2.alan.tom@gmail.com>
* refactor: company form fields arrangement
* refactor: accounts onboarding steps
* refactor: re-arrange fields & modify labels in company form
* feat: onbording steps for accounts module
* fix: updated onboarding steps for selling module
* fix: remove unwanted steps from accounts
* feat: add more onboarding steps
* feat: Refactor onboarding-module for accounting workspace
* feat: Add basic asset onboarding steps
* feat: Add basic asset item form tour
* feat: Add basic selling onboarding-steps
* feat: Add basic form tour for purchase recipt
* feat: Add basic form tour for existing asset
* feat: Adding asset category form tour
* feat: Add form tour for asset category
* feat: Refactor sales taxes and charges template form tour with new method
* refactor: Remove old form tour for accounts settings
* refactor: Change asset category form tour with new tour method
* refactor: Change asset item form tour with new tour method
* refactor: Change purchase receipt form tour with new tour method
* refactor: Change asset form tour with new tour method
* refactor: Remove old form tour for selling settings
* refactor: general fix/typo in onboarding steps
* Apply suggestions from code review
Co-authored-by: Nabin Hait <nabinhait@gmail.com>
* refactor: Remove old form tour method for sales order.
* fix: removed duplicate section break
* fix: Removed duplicate fields
Co-authored-by: Saqib Ansari <nextchamp.saqib@gmail.com>
Co-authored-by: Anuja <anuja.pawar20@gmail.com>
Co-authored-by: Afshan <33727827+AfshanKhan@users.noreply.github.com>
Co-authored-by: Nabin Hait <nabinhait@gmail.com>
* 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
* fix: Dont create inward SLE against SI unless is internal customer enabled
- Check if is internal customer enabled apart from target warehouse
- Test to check if inward SLE is made if target warehouse is accidentally set but customer is not internal
* test: Use internal customer for delivery of bundle items to target warehouse
- created `create_internal_customer` util
- reused it in delivery note and sales invoice tests
- use internal customer for target warehouse test in delivery note
* test: tests for correct get_period_date_ranges
* fix: stock analytics report date range issues
- Upon selecting second half of month with Monthly filter, data from
that period was missing.
- Solution: "round down" the date as per expected frequency.
* chore: drop py2 and fix misleading docstring
* test: fix test to avoid FY clash
* feat: add company filter in stock analytics report
[skip ci]
Co-authored-by: Marica <maricadsouza221197@gmail.com>
- remove Is Group from warehouse
- change stock entry type
- link to stock entry type
- add posting date to stock reco
- change report to Stock Projected Qty
- highlight quality inspection action
- remove allow neg highlight
- Use `get_exchange_rate` to check for price list exchange rate in cart settings
- Move cart exchange rate validation for Price List from hooks to doc event
- Call cart exchange rate validation on PL update only if PL is in cart and currency is changed
* 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>
* fix: Faulty Gl Entry for Asset LCVs
- Both Gl entries were crediting in their respective accounts
- Asset Account must be debited into
* fix: Use keyword arguments instead of positional for better readability
* chore: Test for LCV for draft asset created via Purchase Receipt
* fix: Faulty Gl Entry for Asset LCVs
- Both Gl entries were crediting in their respective accounts
- Asset Account must be debited into
* fix: Use keyword arguments instead of positional for better readability
* chore: Test for LCV for draft asset created via Purchase Receipt
* fix: price list with 0 value are ignored
Steps to reproduce:
1. Create 2 item price for two different supplier. One of them should be
zero.
2. Create PO
3. Add supplier with non-zero price and add item.
4. change supplier. Price won't change. If price was non-zero it
would've changed.
Root cause: falsiness check instead of null value check is used for
checking if price list value exists. 0 is evaluated as false.
* refactor: make get_price_list_rate function pure
(cherry picked from commit 16d4de5130)
Co-authored-by: Ankush <ankush@iwebnotes.com>
* fix: price list with 0 value are ignored
Steps to reproduce:
1. Create 2 item price for two different supplier. One of them should be
zero.
2. Create PO
3. Add supplier with non-zero price and add item.
4. change supplier. Price won't change. If price was non-zero it
would've changed.
Root cause: falsiness check instead of null value check is used for
checking if price list value exists. 0 is evaluated as false.
* refactor: make get_price_list_rate function pure
problem: exchange rate API is returning exchange rates for "_Test currency".
These tests were relying on failure of that function.
(cherry picked from commit 27a29eb6bc)
Co-authored-by: Ankush <ankush@iwebnotes.com>
* fix: Assign Item's default weight_per_unit as its weight_per_unit in get_item_details
* fix: Set weight_uom in get_item_details as Item's default weight_uom
(cherry picked from commit 471f48f64d)
Co-authored-by: Ganga Manoj <ganga.manoj98@gmail.com>
* fix: Assign Item's default weight_per_unit as its weight_per_unit in get_item_details
* fix: Set weight_uom in get_item_details as Item's default weight_uom