- Consider negative opening stock in logic and neutralise it with +ve stock
- minor code refactor: class for FIFOSlots to generate chronological FIFO queue
When making a backdated transactions current balance qty depends on
evaluation of whole ledger inbetween, instead of doing that just fetch
the last sle's qty_after_transaction when future transactions are
detected against SLE
fix: don't update bin's actual_qty
1. it's already updated by repost_current_voucher
2. update if future sle exists
mysql is generally smart enough to figure out which index is better
based on cardinality of index. While posting sort index is better for
low item high # of SLE scenario it's bad for high item variety each with
lower count of SLEs.
* fix: reservation for production incorrect
The query uses case to decide what fields to compute reservation on,
this case is outermost case hence the very first Work order's "Skip
transfer" is considered for ALL work orders.
Solution: move the case inside Sum.
Steps to reproduce:
1. Make work order for more than 1 qty (with | without skip transfer)
2. Create manufacture and transfer entries.
3. Keep checking reserved quantities during this process.
* test: use default warehouse for testing reservation
* fix: misleading "Set Default X" fields after saving
* refactor: remove unncessary code and minor formatting
* fix: extend to more doctypes and correct fieldnames
Co-authored-by: Ankush Menat <ankush@frappe.io>
This check was only checking total sum, which is problamatic when making
backdated entries that can cause intermediate values to go negative
while overall values stay positive.
batch's ledger is only maintained in form of `actual_qty` on batch's
SLEs. To validate if batch has any negative qty in future, cumulative
total of `actual_qty` is required to ensure it never goes negative.
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.
- System cant differentiate between scrap and FG when WO is absent, so dont auto set
- User must set it manually
- `validate_finished_goods` checks this
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.
- Incorrect path and Settings in price_list.py import due to merge
- Extra space removed in website_item.py
- Changed client side namespace to `erpnext.e_commerce.*`
- Removed `Home Page is Products` checkbox in E Comm Settings. Can be manually set in Website Settings
- Removed hooks trigger to reset home page as products
- Sider: duplicate color attribute, shift `return` to next line, over-indentation
- Test for ProductQuery engine and ProductFilters engine
- Test for engine for Item Group too
- Renamed ‘product_configurator’ to ‘variant_selector’
- Cleaned up filters.py
- Modal freeze backdrop lighter only in cart, since there’s nothing over it
- Fixed unusual spacing in variant selector dialog
- Made `get_child_groups_for_website` more readable
- Replaced ‘Configure’ with ‘Select’ for variant selection
- Tests for website item. Desk tests and portal tests
- Allow guests on method `get_offer_details`
- Fetch stock details only if `show_stock_availability` is enabled
- Validation for duplicate web items on item merge
- Separate method for `validate_properties_before_merge`
- Common error title and exception `DataValidationError` for merge validations on Item
- Added Short Description in Website Item for List View
- Update Website Item on Item info change
- Un-publish Web Item if Item is disabled
- Removed unnecessary dependency on Item from query engine
- Rearranged item detail fields in Website Item
- Added Link to Website Item on Item Dashboard
- 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
- Moved all files and web templates from Shopping Cart to E-commerce module
- Made Shopping Cart module obsolete
- Moved select E-commerce related files from Portal to E-commerce module
- Minor cleanups
- Fixed Shopping Cart and Product Configurator tests
- Patch to make website item from item
- Patch to move Products and Shopping Cart Settings into E Commerce Settings
- Patch to move products in Homepage from Item to Website Item
- Minor cleanup, replacing/removing references to Item website fields (obsolete)
- Removed Shopping Cart Settings
- Portal fully driven via E Commerce Settings
- All Item listing querying will happen via ProductQuery engine only
- Product Listing via Website Items
- removed redundant code
- Moved all website logic from Item to Website Item
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>