Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: made item or warehouse filter mandatory #36208

Conversation

rohitwaghchaure
Copy link
Collaborator

If Stock Ledger Entries count is more than 10,000 then user should select the filter of Item Code or Warehouse to view the Batch Wise Balance History Report.

Screenshot 2023-07-20 at 12 59 38 PM

Why Mandatory?

Currently, users are facing performance issues and are unable to generate the report due to the lack of a filter on large data.

@github-actions github-actions bot added the needs-tests This PR needs automated unit-tests. label Jul 20, 2023
@rohitwaghchaure rohitwaghchaure added backport version-14-hotfix backport to version 14 and removed needs-tests This PR needs automated unit-tests. labels Jul 20, 2023
@codecov
Copy link

codecov bot commented Jul 20, 2023

Codecov Report

Merging #36208 (1649862) into develop (c16a581) will decrease coverage by 0.06%.
The diff coverage is 65.62%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #36208      +/-   ##
===========================================
- Coverage    64.20%   64.14%   -0.06%     
===========================================
  Files          785      784       -1     
  Lines        60703    60712       +9     
===========================================
- Hits         38975    38946      -29     
- Misses       21728    21766      +38     
Impacted Files Coverage Δ
...ange_rate_revaluation/exchange_rate_revaluation.py 55.98% <0.00%> (ø)
erpnext/accounts/utils.py 73.54% <ø> (-0.17%) ⬇️
...ext/manufacturing/doctype/work_order/work_order.py 80.41% <ø> (ø)
erpnext/stock/doctype/item/item.py 85.66% <0.00%> (ø)
erpnext/assets/doctype/asset/depreciation.py 81.31% <23.07%> (ø)
erpnext/controllers/stock_controller.py 82.49% <50.00%> (ø)
...xt/assets/doctype/asset_movement/asset_movement.py 77.61% <60.00%> (+4.75%) ⬆️
erpnext/controllers/buying_controller.py 84.66% <66.66%> (ø)
...wise_balance_history/batch_wise_balance_history.py 73.75% <75.00%> (+0.06%) ⬆️
...e/subcontracting_receipt/subcontracting_receipt.py 90.25% <85.71%> (ø)
... and 3 more

... and 32 files with indirect coverage changes

@rohitwaghchaure rohitwaghchaure merged commit 9a9939c into frappe:develop Jul 20, 2023
13 of 14 checks passed
s-aga-r pushed a commit that referenced this pull request Jul 20, 2023
fix: made item or warehouse filter mandatory

(cherry picked from commit 1649862)

Co-authored-by: Rohit Waghchaure <rohitw1991@gmail.com>
deepeshgarg007 added a commit that referenced this pull request Jul 21, 2023
* fix: broken overallocation validation in payment entry

In a multi term payment schedule, overallocation logic broke. Fixing
it using individual term outstanding amount in references. this should
work for the simple, one term payment schedule as well

(cherry picked from commit f8d4b19)

* refactor: payment term outstanding in party account currency

(cherry picked from commit ee83f94)

* fix: Default fiscal year in accounting, buying and sellingcharts

(cherry picked from commit 3759a41)

* fix: Trial Balance report considering cancelled entries

(cherry picked from commit fd58bbf)

* fix: made item or warehouse filter mandatory (backport #36208) (#36215)

fix: made item or warehouse filter mandatory

(cherry picked from commit 1649862)

Co-authored-by: Rohit Waghchaure <rohitw1991@gmail.com>

* fix: Ambiguous column error while submitting stock entry (backport #36209) (#36222)

fix: Ambiguous column error while submitting stock entry

Stock Entry Type=Manufacture

request.js:457 Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 94, in application
    response = frappe.api.handle()
  File "apps/frappe/frappe/api.py", line 54, in handle
    return frappe.handler.handle()
  File "apps/frappe/frappe/handler.py", line 47, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 85, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1610, in call
    return fn(*args, **newargs)
  File "apps/frappe/frappe/desk/form/save.py", line 28, in savedocs
    doc.save()
  File "apps/frappe/frappe/model/document.py", line 305, in save
    return self._save(*args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 327, in _save
    return self.insert()
  File "apps/frappe/frappe/model/document.py", line 259, in insert
    self.run_before_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1045, in run_before_save_methods
    self.run_method("validate")
  File "apps/frappe/frappe/model/document.py", line 914, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1264, in composer
    return composed(self, method, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1246, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "apps/frappe/frappe/model/document.py", line 911, in fn
    return method_object(*args, **kwargs)
  File "apps/erpnext/erpnext/stock/doctype/stock_entry/stock_entry.py", line 122, in validate
    self.validate_qty()
  File "apps/erpnext/erpnext/stock/doctype/stock_entry/stock_entry.py", line 433, in validate_qty
    transferred_materials = frappe.db.sql(
  File "apps/frappe/frappe/database/database.py", line 220, in sql
    self._cursor.execute(query, values)
  File "env/lib/python3.10/site-packages/pymysql/cursors.py", line 158, in execute
    result = self._query(query)
  File "env/lib/python3.10/site-packages/pymysql/cursors.py", line 325, in _query
    conn.query(q)
  File "env/lib/python3.10/site-packages/pymysql/connections.py", line 549, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "env/lib/python3.10/site-packages/pymysql/connections.py", line 779, in _read_query_result
    result.read()
  File "env/lib/python3.10/site-packages/pymysql/connections.py", line 1157, in read
    first_packet = self.connection._read_packet()
  File "env/lib/python3.10/site-packages/pymysql/connections.py", line 729, in _read_packet
    packet.raise_for_error()
  File "env/lib/python3.10/site-packages/pymysql/protocol.py", line 221, in raise_for_error
    err.raise_mysql_exception(self._data)
  File "env/lib/python3.10/site-packages/pymysql/err.py", line 143, in raise_mysql_exception
    raise errorclass(errno, errval)
pymysql.err.OperationalError: (1052, "Column 'qty' in field list is ambiguous")

(cherry picked from commit c21fd45)

Co-authored-by: MohsinAli <mmatiyailol@gmail.com>

* fix: Ignore permissions while submitting account closing balance record (#35536)

(cherry picked from commit f11d9b0)

* fix: FY in naming series variable for orders

(cherry picked from commit 7a7d32d)

---------

Co-authored-by: ruthra kumar <ruthra@erpnext.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Rohit Waghchaure <rohitw1991@gmail.com>
Co-authored-by: MohsinAli <mmatiyailol@gmail.com>
Co-authored-by: Nabin Hait <nabinhait@gmail.com>
frappe-pr-bot pushed a commit that referenced this pull request Jul 26, 2023
# [14.32.0](v14.31.3...v14.32.0) (2023-07-26)

### Bug Fixes

* added missing option Partially Received in the status dropdown field ([4fa93b0](4fa93b0))
* allocation logic on 'Get Outstanding Invoices' btn in PE ([14600fa](14600fa))
* allow both custodian and location while creating asset ([#36263](#36263)) ([2b47f58](2b47f58))
* Ambiguous column error while submitting stock entry (backport [#36209](#36209)) ([#36222](#36222)) ([844ec58](844ec58))
* apply discount on item after applying price list ([#36316](#36316)) ([cff6e72](cff6e72))
* apply terms validaton only in Sales/Purchase documents ([8f24292](8f24292))
* broken overallocation validation in payment entry ([e1d31aa](e1d31aa))
* clear accounting dimension value when based on field changes ([1fe6d4e](1fe6d4e))
* customer filter in process soa ([5938af9](5938af9))
* Default fiscal year in accounting, buying and sellingcharts ([8ca3d6b](8ca3d6b))
* fetch acc dimension fieldname ([542c804](542c804))
* FY in naming series variable for orders ([6a6a3ae](6a6a3ae))
* group by in fixed asset register ([#36310](#36310)) ([6cca18e](6cca18e))
* Ignore permissions while submitting account closing balance record ([#35536](#35536)) ([c2976ef](c2976ef))
* itemised tax breakup ([6f2e639](6f2e639))
* made item or warehouse filter mandatory (backport [#36208](#36208)) ([#36215](#36215)) ([57cf3c2](57cf3c2))
* no default email account causing reposting issue ([026f9f5](026f9f5))
* **regional:** set `frappe.flags.company` temporarily, where required ([73e9b38](73e9b38))
* set new purchase_receipt_amount on asset split ([#36272](#36272)) ([e867fe7](e867fe7))
* timeout error while cancelling the Purchase Receipt ([0575005](0575005))
* Trial Balance report considering cancelled entries ([ca4f86d](ca4f86d))

### Features

* filter based on accounting dimension in profitability analysis ([ba95df2](ba95df2))

def execute(filters=None):
if not filters:
filters = {}

sle_count = frappe.db.count("Stock Ledger Entry", {"is_cancelled": 0})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This query will likely do full table scan because is_cancelled is not indexed.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport version-14-hotfix backport to version 14
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants