From bd9e0e8b5a87ecb3cefa0392456c2aac15625d62 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Fri, 21 Jul 2023 16:15:31 +0530 Subject: [PATCH] chore: release version 14 (#36233) * 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 f8d4b19cb987b267dbd18d6ef1ab52426d7f51d1) * refactor: payment term outstanding in party account currency (cherry picked from commit ee83f94bb0ad22e487d63e41cb878ffc27f974fc) * fix: Default fiscal year in accounting, buying and sellingcharts (cherry picked from commit 3759a41b8358302ff8d33857a0461cc2da3d06d8) * fix: Trial Balance report considering cancelled entries (cherry picked from commit fd58bbff6bbed96367544f0ab0be9d992fafef56) * fix: made item or warehouse filter mandatory (backport #36208) (#36215) fix: made item or warehouse filter mandatory (cherry picked from commit 16498627cec1e416fcc9a911b11ca522268eb622) Co-authored-by: Rohit Waghchaure * 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 c21fd45883d3b2a6d2ba32c5f91d5151c8df0650) Co-authored-by: MohsinAli * fix: Ignore permissions while submitting account closing balance record (#35536) (cherry picked from commit f11d9b019ddf8238c9e53369262a89fb4041e0ab) * fix: FY in naming series variable for orders (cherry picked from commit 7a7d32db817ab6619168ad3582abe23c197d6419) --------- Co-authored-by: ruthra kumar Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Rohit Waghchaure Co-authored-by: MohsinAli Co-authored-by: Nabin Hait --- .../account_closing_balance/account_closing_balance.py | 1 + erpnext/accounts/utils.py | 3 ++- erpnext/stock/doctype/stock_entry/stock_entry.py | 2 +- .../batch_wise_balance_history.py | 7 +++++++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/account_closing_balance/account_closing_balance.py b/erpnext/accounts/doctype/account_closing_balance/account_closing_balance.py index ea67051fb49..e75af7047f1 100644 --- a/erpnext/accounts/doctype/account_closing_balance/account_closing_balance.py +++ b/erpnext/accounts/doctype/account_closing_balance/account_closing_balance.py @@ -36,6 +36,7 @@ def make_closing_entries(closing_entries, voucher_name, company, closing_date): "closing_date": closing_date, } ) + cle.flags.ignore_permissions = True cle.submit() diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index 84c71b376ef..aa861a48eff 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -1108,7 +1108,8 @@ def get_autoname_with_number(number_value, doc_title, company): def parse_naming_series_variable(doc, variable): if variable == "FY": - return get_fiscal_year(date=doc.get("posting_date"), company=doc.get("company"))[0] + date = doc.get("posting_date") or doc.get("transaction_date") or getdate() + return get_fiscal_year(date=date, company=doc.get("company"))[0] @frappe.whitelist() diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index ae9adc826c6..b93ffc437cb 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -433,7 +433,7 @@ class StockEntry(StockController): transferred_materials = frappe.db.sql( """ select - sum(qty) as qty + sum(sed.qty) as qty from `tabStock Entry` se,`tabStock Entry Detail` sed where se.name = sed.parent and se.docstatus=1 and diff --git a/erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.py b/erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.py index 0d57938e31f..0f319554763 100644 --- a/erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.py +++ b/erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.py @@ -9,11 +9,18 @@ from pypika import functions as fn from erpnext.stock.doctype.warehouse.warehouse import apply_warehouse_filter +SLE_COUNT_LIMIT = 10_000 + def execute(filters=None): if not filters: filters = {} + sle_count = frappe.db.count("Stock Ledger Entry", {"is_cancelled": 0}) + + if sle_count > SLE_COUNT_LIMIT and not filters.get("item_code") and not filters.get("warehouse"): + frappe.throw(_("Please select either the Item or Warehouse filter to generate the report.")) + if filters.from_date > filters.to_date: frappe.throw(_("From Date must be before To Date"))