* fix: Auto Insert Item Price If Missing when discount and blank UOM
fixes wrong item price insert when discount is used and adds uom=stock_uom instead of blank as price is converted to stock uom
* unit tests added for item with discount
I have added test for auto_insert_price where discount is used.
* unit test issue fixed
fixed make_sales_order as some of the test that depended on it were failing due to passing of incorrect parameters.
Co-authored-by: Ankush Menat <me@ankush.dev>
- If `Update Cost` job is ongoing, then block creation of new ones since all BOMs are updated
- `db_update` in `calculate_rm_cost` only if changed values to reduce redundant row updates
- Misc: Use variable for batch size
This is broken again after serializing scan actions, which causes
selector to trigger before batch_no is set.
Solution: for duration of scan disable the selector
Profitability Analysis includes 'is_cancelled' GL Entries which means that the profit numbers are incorrect. This change will ensure that the profit figures ignore cancelled GL Entries.
* fix: resolve row after model is updated.
* fix: wait for all fields in the model to be updated.
* fix: sider
* pref: clear scanned code after capturing value
* fix: use frappe.run_serially
- Separate getting dependants and checking if they are valid (loop within loop led to redundant processing that slowed down function)
- Adding to above, the same dependant(parent) was repeatedly processed as many children shared it. Expensive.
- Use a parent-child map similar to child-parent map to check if all children are resolved
- `map.get()` reduced time: 10 mins -> 0.9s~1 second (as compared to `get_cached_doc` or query)
- Total time: 17 seconds to process 6599 leaf boms and 4.2L parent boms
- Previous Total time: >10 mins (I terminated it due to not wanting to waste time XD)
* fix: date filter
fix from date to to date filter btw those days
* fix: remove unnecessary conditions
Co-authored-by: Ankush Menat <ankushmenat@gmail.com>
- Generate RM-Rate map from Items table (will include subassembly items with rate)
- Function to reset exploded item rate from above map
- `db_update` exploded item rate only if rate is changed
- Via Update Cost, only update exploded items rate, do not regenerate table again
- Exploded Items are regenerated on Save and Replace BOM job
- `calculate_exploded_cost` is run only via non doc events (Update Cost button, Update BOMs Cost Job)