fix: offset some scheduled jobs to avoid locks (#31466)
If your site has multiple background workers then there's possibility
that two jobs will execute in parallal, this creates problem when both
are on operating on same data.
This PR adds a separate section for hourly and daily jobs which have
frequency offset from default frequency to avoid such conflicts.
(cherry picked from commit 5d73697c64)
Co-authored-by: Ankush Menat <ankush@frappe.io>
fix: dont update RM items table if not required (#31408)
Currently on PO update RM item table is auto computed again and again,
if there was any transfer/consumption against that then it will be lost.
This change:
1. Disables updating RM table if no change in qty of FG was made. Since
RM table can't possibly be different with same FG qty.
2. Blocks update completely if qty is changed and RM items are already
transferred.
(cherry picked from commit dd11f26eba)
Co-authored-by: Ankush Menat <ankush@frappe.io>
refactor: clean up product bundle client side code (#31455)
refactor: clean up product bundle cient side code
- Remove deprecated CUR_FRM scripts
- Remove client side fetches and move it to doctype schema
(cherry picked from commit 20dac08f5f)
Co-authored-by: Ankush Menat <ankush@frappe.io>
* fix(Salary Slip): Components not updated when amount evaluates to 0 due to payment days
* fix: remove 0 valued components that have been updated later
- Delete `BOM Update Batch` table on 'Completed' log, to save space
- Hide Progress section on 'Completed' log
- Enqueue `on_submit` for 'Update Cost' job, getting leaf boms could take time for huge DBs. Users have to wait for screen to unfreeze.
- Add error handling to `process_boms_cost_level_wise` (Called via cron job and on submit, both in background)
* fix: Respect system precision for user facing balance qty values
- `get_precision` -> `set_precision`
- Use system wide currency precision for `stock_value`
- Round of qty defiiciency as per user defined precision (system flt precision), so that it is WYSIWYG for users
* fix: Consider system precision when validating future negative qty
* test: Immediate Negative Qty precision test
- Test for Immediate Negative Qty precision
- Stock Entry Negative Qty message: Format available qty in system precision
- Pass `stock_uom` as confugrable option in `make_item`
* test: Future Negative Qty validation with precision
* fix: Use `get_field_precision` for currency precision as it used to
- `get_field_precision` defaults to number format for precision (maintain old behaviour)
- Don't pass `currency` to `get_field_precision` as its not used anymore
(cherry picked from commit d6078aa911)
# Conflicts:
# erpnext/stock/doctype/stock_ledger_entry/test_stock_ledger_entry.py
fix: UOM handling for transaction without item (#31389)
If invoice is made without item code then UOM, Stock UOM and
conversion_factor all need to be manually added, this is confusing and
leads missing them out leads to errors.
Simplest solution:
- if either UOM exists then set both to same uom conversion factor to
- also set conversion factor based on UOM conversions
(cherry picked from commit 10583eb3ce)
Co-authored-by: Ankush Menat <ankush@frappe.io>
* fix: transaction date gets unset in material request (#31327)
* fix: set date correctly in material request
* fix: use only `transaction_date` in `get_item_details`
* fix: resolve merge conflict
Co-authored-by: Sagar Vora <sagar@resilient.tech>
* fix: dont use cached doc for GLE reposts
ported from https://github.com/frappe/erpnext/pull/31240
* perf: GLE reposting with progress and chunking
If stock voucher count goes >1000 then fetching all gles and reposting
them all at once requires much more memory and can cause crash.
- This PR ensures that GLE reposting is done in chunks of 100 vouchers.
- This PR also starts keeping track of how many such chunks were
processed so in future progress is resumed in event of timeout.
* test: add "actual" test for chunked GLE reposting
- Use `get_default_bom` in sales_order.py (reduce duplicate utility functions)
- Remove redundant if else in `get_work_order_items`
- `get_default_bom`: If no BOM and template exists try to fetch template BOM
- test: `get_work_order_items` via SO and if right BOM is picked
(cherry picked from commit 9f2d325e67)