From 6e479f918d900175bac25bb878d2ebed58c52cf8 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 27 Dec 2023 08:40:26 +0000 Subject: [PATCH 01/39] chore(release): Bumped to Version 14.57.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # [14.57.0](https://github.com/frappe/erpnext/compare/v14.56.0...v14.57.0) (2023-12-27) ### Bug Fixes * allow to set rate manually for service item in BOM ([#38880](https://github.com/frappe/erpnext/issues/38880)) ([c2f692a](https://github.com/frappe/erpnext/commit/c2f692a4e4f3dd5089fe4949c6cd74574282fdb1)) * display all item rate stop messages ([226d0e0](https://github.com/frappe/erpnext/commit/226d0e0196f8c5defddc600348364d39fa703f27)) * do not reset the basic rate for the material receipt stock entry ([#38896](https://github.com/frappe/erpnext/issues/38896)) ([98bfcc4](https://github.com/frappe/erpnext/commit/98bfcc4c758b61f714c53ea0f00246731a30fdaf)) * first name error on customer creation ([#38927](https://github.com/frappe/erpnext/issues/38927)) ([28f052d](https://github.com/frappe/erpnext/commit/28f052d586c2781136b2e6497b7f3731a5b5227e)) * german translations for Lost Quotations ([#38435](https://github.com/frappe/erpnext/issues/38435)) ([81b5e6c](https://github.com/frappe/erpnext/commit/81b5e6c5f13da686d4472168b731e7e284a4e9c2)) * groups for current accounts in German CoAs ([39aa36e](https://github.com/frappe/erpnext/commit/39aa36e44b66123443c66e3503c1d6bb8c277447)) * incorrect price list in customer-wise item price report ([7577706](https://github.com/frappe/erpnext/commit/7577706a9dc0a050cc3ed401f44f15a528b8d573)) * min order qty optional in production plan (backport [#38956](https://github.com/frappe/erpnext/issues/38956)) ([#38957](https://github.com/frappe/erpnext/issues/38957)) ([f6f2712](https://github.com/frappe/erpnext/commit/f6f2712db0cd8cec3940e7e31678d909307887b9)) * remove rows with zero consumed qty ([f2f4100](https://github.com/frappe/erpnext/commit/f2f410093aa688d004637cb3a7a0052498351d8e)) * reposting not fixing valuation rate for sales return using movin… ([#38895](https://github.com/frappe/erpnext/issues/38895)) ([3a668bb](https://github.com/frappe/erpnext/commit/3a668bbe9694fdd6e8265869c6943e42f889ac41)) * reset the incoming rate on changing of the warehouse ([#38909](https://github.com/frappe/erpnext/issues/38909)) ([2770ca1](https://github.com/frappe/erpnext/commit/2770ca1b659a3217e249b60155434052d0a62730)) * skip jvs against bank accounts ([98198d3](https://github.com/frappe/erpnext/commit/98198d35eaa8909396a6ced5ad274931b7f90dcf)) * **test:** expect account currency when party account is specified. ([30cb218](https://github.com/frappe/erpnext/commit/30cb2186380f0eafce20fcdbcaf3b209dfd6b46b)) * unset discount amount from coupon discounts ([87e8dd0](https://github.com/frappe/erpnext/commit/87e8dd0d63068b93c713c4636e97cc3edda411fd)) * use party account currency when party account is specified ([d9e0d55](https://github.com/frappe/erpnext/commit/d9e0d55b88e428f80a9e84eb4309f2c153b7028f)) * **ux:** make PR and PI Item rate field readonly based on `Maintain Same Rate` (backport [#38942](https://github.com/frappe/erpnext/issues/38942)) ([#38943](https://github.com/frappe/erpnext/issues/38943)) ([1eee203](https://github.com/frappe/erpnext/commit/1eee203f7fb840e3aeb23b5a07231764cb2afef3)) ### Features * in_party_currency option for AR/AP reports ([3c717db](https://github.com/frappe/erpnext/commit/3c717db3fd2d88f3fbad053c0b71b9a99b62c9b6)) * total_asset_cost field (backport [#38879](https://github.com/frappe/erpnext/issues/38879)) ([#38886](https://github.com/frappe/erpnext/issues/38886)) ([8169c7d](https://github.com/frappe/erpnext/commit/8169c7de0d06ce031f44c30016d1f17744655bf5)) ### Performance Improvements * Drop unused/duplicate/sub-optimal indexes (backport [#38884](https://github.com/frappe/erpnext/issues/38884)) ([#38912](https://github.com/frappe/erpnext/issues/38912)) ([b254a72](https://github.com/frappe/erpnext/commit/b254a72d41bd701cf93752771681b0f55e93a6f7)) * use estimated rows instead of actual rows (backport [#38830](https://github.com/frappe/erpnext/issues/38830)) ([#38875](https://github.com/frappe/erpnext/issues/38875)) ([4d1ccd9](https://github.com/frappe/erpnext/commit/4d1ccd9e27302d161e899fc6b6b02f33a1743844)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 85dbe99af84..8386b715981 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.56.0" +__version__ = "14.57.0" def get_default_company(user=None): From b6a36270b2b7196e72180e39bc32277683633673 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 3 Jan 2024 06:01:14 +0000 Subject: [PATCH 02/39] chore(release): Bumped to Version 14.58.0 # [14.58.0](https://github.com/frappe/erpnext/compare/v14.57.0...v14.58.0) (2024-01-03) ### Bug Fixes * Add missing french translations (backport [#38368](https://github.com/frappe/erpnext/issues/38368)) ([#38513](https://github.com/frappe/erpnext/issues/38513)) ([2c90ee2](https://github.com/frappe/erpnext/commit/2c90ee23f9dd1f3011b063c7fc074e6d36f1e5f6)) * **DX:** capture tracebacks with context (backport [#39060](https://github.com/frappe/erpnext/issues/39060)) ([#39062](https://github.com/frappe/erpnext/issues/39062)) ([fe9acc8](https://github.com/frappe/erpnext/commit/fe9acc898ec51073a4a75e3cf20457f0cd161909)) * **Hierarchy Chart:** check if company is set before loading children ([#38985](https://github.com/frappe/erpnext/issues/38985)) ([e4d6df3](https://github.com/frappe/erpnext/commit/e4d6df39ff273402096c32ed0a1bc359d26bfee2)) * issue occured when creating supplier with contact details (backport [#38147](https://github.com/frappe/erpnext/issues/38147)) ([#39046](https://github.com/frappe/erpnext/issues/39046)) ([81ef7b4](https://github.com/frappe/erpnext/commit/81ef7b4c00c02226b2c1f87add9fd022e40a24c6)) * Opening balance in bank reconciliation tool ([#38977](https://github.com/frappe/erpnext/issues/38977)) ([a2cba1b](https://github.com/frappe/erpnext/commit/a2cba1bf237dd26e9cf9be7a4d903afc2441cdf6)) * remove bad defaults (backport [#38986](https://github.com/frappe/erpnext/issues/38986)) ([#38987](https://github.com/frappe/erpnext/issues/38987)) ([29d383a](https://github.com/frappe/erpnext/commit/29d383ad8b76179d977be9b78c891738fd9a3364)) * select options should dynamically load dimensions ([bfc94cf](https://github.com/frappe/erpnext/commit/bfc94cf284cd50af0a5f038b3ab1dfb4000d010d)) * take quantity into account when setting asset's gross purchase amt (backport [#39056](https://github.com/frappe/erpnext/issues/39056)) ([#39057](https://github.com/frappe/erpnext/issues/39057)) ([b8dce3e](https://github.com/frappe/erpnext/commit/b8dce3eeac8c8e6586e29aa7ab0b6eead318a7e2)) * undefined error in Budget Variance and Profitability report ([cad15cd](https://github.com/frappe/erpnext/commit/cad15cdec25d630dc14819647f745d8936c8f908)) * use `Stock Qty` while getting `POS Reserved Qty` (backport [#38962](https://github.com/frappe/erpnext/issues/38962)) ([#38982](https://github.com/frappe/erpnext/issues/38982)) ([7ad42ec](https://github.com/frappe/erpnext/commit/7ad42ec95749c0055a0dc6072024b497a1545d80)) * Validate account in Sales/Purchase Taxes and Charges Template ([#39013](https://github.com/frappe/erpnext/issues/39013)) ([c0b5980](https://github.com/frappe/erpnext/commit/c0b598074c3defaca233231646fb5d558236bbc8)) * work order with multi level, fetch operting cost from sub-assembly (backport [#38992](https://github.com/frappe/erpnext/issues/38992)) ([#39027](https://github.com/frappe/erpnext/issues/39027)) ([88e5c9e](https://github.com/frappe/erpnext/commit/88e5c9e61b27e15e75e3c8c1d060d8ae252ecd1b)) ### Features * Merge taxes from mapped docs ([#38346](https://github.com/frappe/erpnext/issues/38346)) ([c74e6aa](https://github.com/frappe/erpnext/commit/c74e6aaebb0b7900a92c53a53740c4f4d3540a1b)) * Show Ledger view for Purchase & Sales Register ([#38801](https://github.com/frappe/erpnext/issues/38801)) ([04fb215](https://github.com/frappe/erpnext/commit/04fb215ff51a7d36d90d3b3d9f9375035cee496e)) ### Performance Improvements * index item_code in bom explosion item (backport [#39085](https://github.com/frappe/erpnext/issues/39085)) ([#39087](https://github.com/frappe/erpnext/issues/39087)) ([558861b](https://github.com/frappe/erpnext/commit/558861b6341febc7e5499bffc691b05b18e72c7f)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 8386b715981..e5d05ff717f 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.57.0" +__version__ = "14.58.0" def get_default_company(user=None): From 43cc7e4a59c3a84fc748110c06cdfb3bab4721e8 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 3 Jan 2024 17:59:15 +0530 Subject: [PATCH 03/39] fix: typerror on multi select dialog (cherry picked from commit 7da9ffa3bd072fbfc9627e6eb5afb3dd3078f560) --- erpnext/public/js/utils.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js index 35c3828d5b9..682762678ba 100755 --- a/erpnext/public/js/utils.js +++ b/erpnext/public/js/utils.js @@ -759,16 +759,20 @@ erpnext.utils.map_current_doc = function(opts) { } if (opts.source_doctype) { + let data_fields = []; + if(opts.source_doctype == "Purchase Receipt") { + data_fields.push({ + fieldname: 'merge_taxes', + fieldtype: 'Check', + label: __('Merge taxes from multiple documents'), + }); + } const d = new frappe.ui.form.MultiSelectDialog({ doctype: opts.source_doctype, target: opts.target, date_field: opts.date_field || undefined, setters: opts.setters, - data_fields: [{ - fieldname: 'merge_taxes', - fieldtype: 'Check', - label: __('Merge taxes from multiple documents'), - }], + data_fields: data_fields, get_query: opts.get_query, add_filters_group: 1, allow_child_item_selection: opts.allow_child_item_selection, @@ -782,7 +786,10 @@ erpnext.utils.map_current_doc = function(opts) { return; } opts.source_name = values; - opts.args = args; + if (opts.allow_child_item_selection || opts.source_doctype == "Purchase Receipt") { + // args contains filtered child docnames + opts.args = args; + } d.dialog.hide(); _map(); }, From feaa16d74855e8eda28b8289a65b7677a825edef Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 3 Jan 2024 15:37:55 +0000 Subject: [PATCH 04/39] chore(release): Bumped to Version 14.58.1 ## [14.58.1](https://github.com/frappe/erpnext/compare/v14.58.0...v14.58.1) (2024-01-03) ### Bug Fixes * typerror on multi select dialog ([43cc7e4](https://github.com/frappe/erpnext/commit/43cc7e4a59c3a84fc748110c06cdfb3bab4721e8)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index e5d05ff717f..c6e5405c7db 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.58.0" +__version__ = "14.58.1" def get_default_company(user=None): From 2e6f1378f1fd079026e52ebc39991952977fa1de Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 10 Jan 2024 10:35:32 +0000 Subject: [PATCH 05/39] chore(release): Bumped to Version 14.59.0 # [14.59.0](https://github.com/frappe/erpnext/compare/v14.58.1...v14.59.0) (2024-01-10) ### Bug Fixes * add read permission to Buying Settings (backport [#39158](https://github.com/frappe/erpnext/issues/39158)) ([#39257](https://github.com/frappe/erpnext/issues/39257)) ([a15ad80](https://github.com/frappe/erpnext/commit/a15ad804d008613afdf92e9dcd2b8ac415780304)) * asset WDV depreciation calc according to IT act ([1cbe1e8](https://github.com/frappe/erpnext/commit/1cbe1e894d1fe4d760e75e72b0b8792f78741f5b)) * BOM replace tool does not update exploded items of root (backport [#39244](https://github.com/frappe/erpnext/issues/39244)) ([#39249](https://github.com/frappe/erpnext/issues/39249)) ([c2eeeec](https://github.com/frappe/erpnext/commit/c2eeeecac8c934098d289eb32bfbe995587f6987)) * don't set rate for non-stock item in Internal Transfer (backport [#39140](https://github.com/frappe/erpnext/issues/39140)) ([#39168](https://github.com/frappe/erpnext/issues/39168)) ([06d193a](https://github.com/frappe/erpnext/commit/06d193ad87ebb98bbfad1d79fa0c9afaf5f860d2)) * Duplicate Closing Stock Balance (backport [#39262](https://github.com/frappe/erpnext/issues/39262)) ([#39263](https://github.com/frappe/erpnext/issues/39263)) ([a3146c3](https://github.com/frappe/erpnext/commit/a3146c39dd36d8edb7b99cbd57ade2472f475ee2)) * **Employee:** treeview ([#39126](https://github.com/frappe/erpnext/issues/39126)) ([080a742](https://github.com/frappe/erpnext/commit/080a742725f37c0b4514f534a7fc4362c5276db0)) * FG Item incorrect qty in the work order (backport [#39200](https://github.com/frappe/erpnext/issues/39200)) ([#39210](https://github.com/frappe/erpnext/issues/39210)) ([5e517cf](https://github.com/frappe/erpnext/commit/5e517cfc775184681a4549b617e7ccaf56f1bbfc)) * Ignore asset qty and status validation while cancelling LCV ([952cee3](https://github.com/frappe/erpnext/commit/952cee3d6a625561c2d39252c2dcfd3d67a7be1a)) * Ignore UP on "allowed to transact with" (backport [#39103](https://github.com/frappe/erpnext/issues/39103)) ([#39104](https://github.com/frappe/erpnext/issues/39104)) ([7d64df0](https://github.com/frappe/erpnext/commit/7d64df05bc3a265023a27d92ea6fdc5e444a6864)) * improved validation message ([580e9f6](https://github.com/frappe/erpnext/commit/580e9f6e10e21dab07080ac2884d0095412239b1)) * incorrect indicator title for portal sales order (backport [#39247](https://github.com/frappe/erpnext/issues/39247)) ([#39254](https://github.com/frappe/erpnext/issues/39254)) ([8c496fb](https://github.com/frappe/erpnext/commit/8c496fbf2b0653a4c2ef1cb23c9b07cab98b8ebe)) * inventory dimension negative stock validation (backport [#39149](https://github.com/frappe/erpnext/issues/39149)) ([#39150](https://github.com/frappe/erpnext/issues/39150)) ([2866f7c](https://github.com/frappe/erpnext/commit/2866f7c44169098b691a5fa31cef5cb2b6ce6e81)) * possible typeerror on transaction.js ([8fe346a](https://github.com/frappe/erpnext/commit/8fe346aef887acfe4939549acc69d380a60b80e1)) * Purchase date and amount is not mandatory for composite asset creation ([0f6477a](https://github.com/frappe/erpnext/commit/0f6477a253844d6e1fc530cbc5d0f7a38eaf0aa4)) * remove global _("translation") calls (backport [#32828](https://github.com/frappe/erpnext/issues/32828)) ([#39231](https://github.com/frappe/erpnext/issues/39231)) ([ee7474b](https://github.com/frappe/erpnext/commit/ee7474ba203d57f0835d31eb80dfdd8f6608af23)) * resolved conflict ([b529883](https://github.com/frappe/erpnext/commit/b52988389750e6d18eb5407ec18bf84b63d783d4)) * set `First Name` in Supplier Contact ([69c460c](https://github.com/frappe/erpnext/commit/69c460c7562103771d5238c1f02af04493651dd8)) * Set asset purchase amount based on qty and valuation_rate ([41e3843](https://github.com/frappe/erpnext/commit/41e384326eb11f6dc18097f035007678b1689c5e)) * set parent doctype on chart (backport [#39286](https://github.com/frappe/erpnext/issues/39286)) ([#39287](https://github.com/frappe/erpnext/issues/39287)) ([a2a8558](https://github.com/frappe/erpnext/commit/a2a85586778dfb31f907a37d6a7c3cc616aebc81)) * Show maintain-stock and is-fixed-asset checkbox in item quick entry dialog ([7b4b630](https://github.com/frappe/erpnext/commit/7b4b630b2c441481b7121df90e4640654e9aed2e)) * Show timesheet table after fetching data from timesheet (backport [#39275](https://github.com/frappe/erpnext/issues/39275)) ([#39280](https://github.com/frappe/erpnext/issues/39280)) ([1cc887a](https://github.com/frappe/erpnext/commit/1cc887a997ee0c2990bff9f14aaa51a24452308a)) * skip rate validation for return `DN Items` with `Moving Average` valuation (backport [#39242](https://github.com/frappe/erpnext/issues/39242)) ([#39265](https://github.com/frappe/erpnext/issues/39265)) ([f42e93b](https://github.com/frappe/erpnext/commit/f42e93bf6c43edeec19fc8f23b9ecab8c9c385ae)) * total allocated percentage for sales team issue ([71f9b7f](https://github.com/frappe/erpnext/commit/71f9b7f67508ef04ad5f1f463e4df6c4dca83554)) * TypeError is pricing rules (backport [#39252](https://github.com/frappe/erpnext/issues/39252)) ([#39259](https://github.com/frappe/erpnext/issues/39259)) ([36ba33c](https://github.com/frappe/erpnext/commit/36ba33c5009e1526a25cc55ed39de5208aa5f090)) * typerror on multi select dialog ([71ecf08](https://github.com/frappe/erpnext/commit/71ecf081c312ffca15059de9e3dc446d43815411)) * update Maintenance Schedule status on Maintenance Visit submit (backport [#39167](https://github.com/frappe/erpnext/issues/39167)) ([#39185](https://github.com/frappe/erpnext/issues/39185)) ([2ea2146](https://github.com/frappe/erpnext/commit/2ea2146b343d13e4cc230e4d1ab8924f997e2b15)) * **UX:** dont override framework's permission check messages (backport [#39118](https://github.com/frappe/erpnext/issues/39118)) ([#39119](https://github.com/frappe/erpnext/issues/39119)) ([26ae708](https://github.com/frappe/erpnext/commit/26ae708d6d59ea04f862a20dcc08555f7bf553ab)) ### Features * Copy project_name, from_time, to_time from timesheet details to sales invoice ([#33726](https://github.com/frappe/erpnext/issues/33726)) ([d0e1162](https://github.com/frappe/erpnext/commit/d0e1162c964bb08c96d6b9a2ed726761d8bc2488)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index c6e5405c7db..6aa2b45fa6b 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.58.1" +__version__ = "14.59.0" def get_default_company(user=None): From 760af497ca551a034e6b73e12a7764da051cedb9 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 10 Jan 2024 21:51:34 +0530 Subject: [PATCH 06/39] feat: provision to select the qty field for Product Page (backport #39292) (#39300) feat: provision to select the qty field for Product Page (#39292) feat: provision to select the qty field to be shown as `In Stock` in product page (cherry picked from commit d42db1174d3f5ffd2f0517e2a39ae10ad05e4eec) Co-authored-by: s-aga-r --- .../e_commerce_settings.json | 10 ++++++- erpnext/patches.txt | 1 + erpnext/utilities/product.py | 29 +++++++++++++------ 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/erpnext/e_commerce/doctype/e_commerce_settings/e_commerce_settings.json b/erpnext/e_commerce/doctype/e_commerce_settings/e_commerce_settings.json index e6f08f708a8..31b3197e12d 100644 --- a/erpnext/e_commerce/doctype/e_commerce_settings/e_commerce_settings.json +++ b/erpnext/e_commerce/doctype/e_commerce_settings/e_commerce_settings.json @@ -31,6 +31,7 @@ "column_break_21", "default_customer_group", "quotation_series", + "show_actual_qty", "checkout_settings_section", "enable_checkout", "show_price_in_quotation", @@ -366,12 +367,19 @@ "fieldtype": "Check", "label": "Enable Redisearch", "read_only_depends_on": "eval:!doc.is_redisearch_loaded" + }, + { + "default": "1", + "description": "If enabled Actual Qty will be shown as In Stock on the product page instead of Projected Qty.", + "fieldname": "show_actual_qty", + "fieldtype": "Check", + "label": "Show Actual Qty" } ], "index_web_pages_for_search": 1, "issingle": 1, "links": [], - "modified": "2022-04-01 18:35:56.106756", + "modified": "2024-01-10 21:06:45.386977", "modified_by": "Administrator", "module": "E-commerce", "name": "E Commerce Settings", diff --git a/erpnext/patches.txt b/erpnext/patches.txt index e464552fa0c..6b7b13ff46e 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -357,3 +357,4 @@ erpnext.patches.v14_0.update_total_asset_cost_field erpnext.patches.v14_0.migrate_gl_to_payment_ledger erpnext.stock.doctype.delivery_note.patches.drop_unused_return_against_index # 2023-12-20 erpnext.patches.v14_0.set_maintain_stock_for_bom_item +execute:frappe.db.set_single_value('E Commerce Settings', 'show_actual_qty', 1) diff --git a/erpnext/utilities/product.py b/erpnext/utilities/product.py index 5b8b6c67c79..49066cd0c8a 100644 --- a/erpnext/utilities/product.py +++ b/erpnext/utilities/product.py @@ -2,6 +2,7 @@ # License: GNU General Public License v3. See license.txt import frappe +from frappe.query_builder.functions import IfNull from frappe.utils import cint, flt, fmt_money, getdate, nowdate from erpnext.accounts.doctype.pricing_rule.pricing_rule import get_pricing_rule_for_item @@ -30,16 +31,26 @@ def get_web_item_qty_in_stock(item_code, item_warehouse_field, warehouse=None): total_stock = 0.0 if warehouses: + qty_field = ( + "actual_qty" + if frappe.db.get_single_value("E Commerce Settings", "show_actual_qty") + else "projected_qty" + ) + + BIN = frappe.qb.DocType("Bin") + ITEM = frappe.qb.DocType("Item") + UOM = frappe.qb.DocType("UOM Conversion Detail") + for warehouse in warehouses: - stock_qty = frappe.db.sql( - """ - select S.actual_qty / IFNULL(C.conversion_factor, 1) - from tabBin S - inner join `tabItem` I on S.item_code = I.Item_code - left join `tabUOM Conversion Detail` C on I.sales_uom = C.uom and C.parent = I.Item_code - where S.item_code=%s and S.warehouse=%s""", - (item_code, warehouse), - ) + stock_qty = ( + frappe.qb.from_(BIN) + .select(BIN[qty_field] / IfNull(UOM.conversion_factor, 1)) + .inner_join(ITEM) + .on(BIN.item_code == ITEM.item_code) + .left_join(UOM) + .on((ITEM.sales_uom == UOM.uom) & (UOM.parent == ITEM.item_code)) + .where((BIN.item_code == item_code) & (BIN.warehouse == warehouse)) + ).run() if stock_qty: total_stock += adjust_qty_for_expired_items(item_code, stock_qty, warehouse) From 5fd68f720415e8a178f455b671f269ece60a557f Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 10 Jan 2024 16:24:39 +0000 Subject: [PATCH 07/39] chore(release): Bumped to Version 14.60.0 # [14.60.0](https://github.com/frappe/erpnext/compare/v14.59.0...v14.60.0) (2024-01-10) ### Features * provision to select the qty field for Product Page (backport [#39292](https://github.com/frappe/erpnext/issues/39292)) ([#39300](https://github.com/frappe/erpnext/issues/39300)) ([760af49](https://github.com/frappe/erpnext/commit/760af497ca551a034e6b73e12a7764da051cedb9)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 6aa2b45fa6b..9b7f9f2ba53 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.59.0" +__version__ = "14.60.0" def get_default_company(user=None): From 49d914bdb678a8bff7e425d80daee8ee1c03b3f5 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 10 Jan 2024 22:22:16 +0530 Subject: [PATCH 08/39] fix: performance issue related to stock entry (backport #39301) (#39302) fix: performance issue related to stock entry (#39301) (cherry picked from commit c67b0a3a6408075785211da20603fbcd829825bb) Co-authored-by: rohitwaghchaure (cherry picked from commit dc7c9e7affa89dab7daf94f68a7205e07b38763f) --- .../manufacturing/doctype/production_plan/production_plan.js | 2 +- .../manufacturing/doctype/production_plan/production_plan.py | 4 ++-- .../doctype/production_plan/test_production_plan.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.js b/erpnext/manufacturing/doctype/production_plan/production_plan.js index cd92263543b..c9c474db7f0 100644 --- a/erpnext/manufacturing/doctype/production_plan/production_plan.js +++ b/erpnext/manufacturing/doctype/production_plan/production_plan.js @@ -173,7 +173,7 @@ frappe.ui.form.on('Production Plan', { method: "set_status", freeze: true, doc: frm.doc, - args: {close : close}, + args: {close : close, update_bin: true}, callback: function() { frm.reload_doc(); } diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.py b/erpnext/manufacturing/doctype/production_plan/production_plan.py index 767b4ccbb1a..c98d639663a 100644 --- a/erpnext/manufacturing/doctype/production_plan/production_plan.py +++ b/erpnext/manufacturing/doctype/production_plan/production_plan.py @@ -503,7 +503,7 @@ class ProductionPlan(Document): frappe.delete_doc("Work Order", d.name) @frappe.whitelist() - def set_status(self, close=None): + def set_status(self, close=None, update_bin=False): self.status = {0: "Draft", 1: "Submitted", 2: "Cancelled"}.get(self.docstatus) if close: @@ -523,7 +523,7 @@ class ProductionPlan(Document): if close is not None: self.db_set("status", self.status) - if self.docstatus == 1 and self.status != "Completed": + if update_bin and self.docstatus == 1 and self.status != "Completed": self.update_bin_qty() def update_ordered_status(self): diff --git a/erpnext/manufacturing/doctype/production_plan/test_production_plan.py b/erpnext/manufacturing/doctype/production_plan/test_production_plan.py index 4f6280ade8f..2b9751926a2 100644 --- a/erpnext/manufacturing/doctype/production_plan/test_production_plan.py +++ b/erpnext/manufacturing/doctype/production_plan/test_production_plan.py @@ -1475,14 +1475,14 @@ class TestProductionPlan(FrappeTestCase): before_qty = flt(frappe.db.get_value("Bin", bin_name, "reserved_qty_for_production_plan")) pln.reload() - pln.set_status(close=True) + pln.set_status(close=True, update_bin=True) bin_name = get_or_make_bin(rm_item, rm_warehouse) after_qty = flt(frappe.db.get_value("Bin", bin_name, "reserved_qty_for_production_plan")) self.assertAlmostEqual(after_qty, before_qty - 10) pln.reload() - pln.set_status(close=False) + pln.set_status(close=False, update_bin=True) bin_name = get_or_make_bin(rm_item, rm_warehouse) after_qty = flt(frappe.db.get_value("Bin", bin_name, "reserved_qty_for_production_plan")) From 5ae050ecd4a9f733b1ed56de2a0a03c37b8acc5d Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 10 Jan 2024 16:55:11 +0000 Subject: [PATCH 09/39] chore(release): Bumped to Version 14.60.1 ## [14.60.1](https://github.com/frappe/erpnext/compare/v14.60.0...v14.60.1) (2024-01-10) ### Bug Fixes * performance issue related to stock entry (backport [#39301](https://github.com/frappe/erpnext/issues/39301)) ([#39302](https://github.com/frappe/erpnext/issues/39302)) ([49d914b](https://github.com/frappe/erpnext/commit/49d914bdb678a8bff7e425d80daee8ee1c03b3f5)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 9b7f9f2ba53..0cfb47a1284 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.60.0" +__version__ = "14.60.1" def get_default_company(user=None): From 3caf11472d7d253a8cc25b07f95a5a74789418d4 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 15 Jan 2024 12:15:15 +0530 Subject: [PATCH 10/39] ci: bump node in release workflow (backport #39377) (backport #39379) (#39381) ci: bump node in release workflow (backport #39377) (#39379) * ci: bump node in release workflow (cherry picked from commit aef87cced7da0524c7ca2dadfcd111aaf13ef0c2) # Conflicts: # .github/workflows/release.yml * chore: `conflicts` --------- Co-authored-by: s-aga-r (cherry picked from commit 4af3159f6245b414d498e8f40d75eaffbbdbdaaa) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ccd712065dc..e6a7f85f81b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,7 +17,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v2 with: - node-version: 18 + node-version: 20 - name: Setup dependencies run: | From 9aa1e7444e018df71b7ae3a3d9af850819ee42bb Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 17 Jan 2024 17:05:44 +0000 Subject: [PATCH 11/39] chore(release): Bumped to Version 14.61.0 # [14.61.0](https://github.com/frappe/erpnext/compare/v14.60.1...v14.61.0) (2024-01-17) ### Bug Fixes * added indexing to improve performance ([d9f7070](https://github.com/frappe/erpnext/commit/d9f7070f92216c2422f4e1ad262e9397fb940969)) * added item group in stock reco ([c69a59c](https://github.com/frappe/erpnext/commit/c69a59c3c6c72ba69a8347b2c2940e2aaa49428e)) * broken dimension filters in Sales/Purchase register ([298cdf5](https://github.com/frappe/erpnext/commit/298cdf5f0efe4e0a0e76157ad0719bee10822c4a)) * Cancel asset capitalisation record on cancellation of asset and vice-versa ([1dff960](https://github.com/frappe/erpnext/commit/1dff96057c72991bfc579184d09edc58739fe01a)) * circular dependency error while deleting QC ([dfcb746](https://github.com/frappe/erpnext/commit/dfcb7467741184da20d0f32d62433732a1acbec4)) * composite asset capitalization using asset components ([ac6020a](https://github.com/frappe/erpnext/commit/ac6020a940335747e25fd10f1ba0dcac7ad0e3b5)) * consider all years in holiday list ([3180266](https://github.com/frappe/erpnext/commit/318026615036dfdc6bb169788e25ae0f9a4520e1)) * date in master document for dictionary condition ([670d615](https://github.com/frappe/erpnext/commit/670d61547fb6a7ee86050c2f1020cd247f12df52)) * empty category in Plaid ([1acaa20](https://github.com/frappe/erpnext/commit/1acaa20ee11056c9f79cab333474bf13dfb56bf6)) * ignore cancelled payments in Sales/Purchase Register ([36b8e97](https://github.com/frappe/erpnext/commit/36b8e972f11cb860c06ca3ca1726103be3217bb4)) * incorrect active serial nos due to backdated transactions ([1a26c70](https://github.com/frappe/erpnext/commit/1a26c70df285176dc282426bc715b83c470075e5)) * incorrect percentage received in purchase invoice ([453700d](https://github.com/frappe/erpnext/commit/453700d0abb59ca67234617d35301daa0640a2ab)) * incorrect sql error if account name has '%' ([d0e3458](https://github.com/frappe/erpnext/commit/d0e3458c8c696fcf5be2b2cfbea47dfb1a260193)) * modified date ([e9d2437](https://github.com/frappe/erpnext/commit/e9d2437c7ac0a547191658d4694370af863cd450)) * modified date ([28434d1](https://github.com/frappe/erpnext/commit/28434d101b381b03475f61b222043df17a2aea51)) * modified date was not set ([724c934](https://github.com/frappe/erpnext/commit/724c934fbbf246c181f40535f037827e39e60c74)) * modified date was not updated ([cb67574](https://github.com/frappe/erpnext/commit/cb6757437ed72377ece6c0ded858019ce2b087be)) * pass accounts as list to query ([a6bc5ca](https://github.com/frappe/erpnext/commit/a6bc5cae90465d6d517c59c61769623724f8eacd)) * performance issue related to stock entry (backport [#39301](https://github.com/frappe/erpnext/issues/39301)) ([#39302](https://github.com/frappe/erpnext/issues/39302)) ([dc7c9e7](https://github.com/frappe/erpnext/commit/dc7c9e7affa89dab7daf94f68a7205e07b38763f)) * possible typeerror in consolidated report ([9395f75](https://github.com/frappe/erpnext/commit/9395f7535b32b02806e7c36d4beb6b44a246a134)) * possible typerror in utils.js ([4ea72f4](https://github.com/frappe/erpnext/commit/4ea72f4b692a846bbd27f75054c229c3f7c167dd)) * project filters on Delivery Note and Sales Order ([520cdb6](https://github.com/frappe/erpnext/commit/520cdb6f32f4477aa9fd0456c6b7c6328c5ccfe1)) * project query controller logic ([f2e577b](https://github.com/frappe/erpnext/commit/f2e577bec749fcbba74c224e2869433f24d7a4bb)) * reset default after test ([6bd01f2](https://github.com/frappe/erpnext/commit/6bd01f227eea82f434efa1e3bdb4f9ab2a3e0f26)) * resolved merge conflict ([4edb73d](https://github.com/frappe/erpnext/commit/4edb73d398d921d76e860cb072b00af20c272cca)) * show bill_date and bill_no in Purchase Register ([4b19792](https://github.com/frappe/erpnext/commit/4b197920c1e3e816f76f153fc8d755820a63eaf6)) * **test:** test case for project query ([98967ed](https://github.com/frappe/erpnext/commit/98967ed58487cc63e0ed345c50b6f0fb1be97eea)) * unreconcile Bank Transaction on cancel of payment voucher ([755576b](https://github.com/frappe/erpnext/commit/755576bd78be12ffc0c6584cd659cc7279624fb0)) * use child table values instead of global min max ([d21fc60](https://github.com/frappe/erpnext/commit/d21fc6055cc25a1d4af6c290c2584e3de30fffc5)) * WDV as per IT Act: calculate yearly amount first and then split it based on months ([3989b97](https://github.com/frappe/erpnext/commit/3989b9757968e4cc5f9676dab5e034ea08b0191e)) * wrong file name ([9d256e1](https://github.com/frappe/erpnext/commit/9d256e131df0a3e73993ef6b8faffc7b883ca89f)) ### Features * provision to select the qty field for Product Page ([#39292](https://github.com/frappe/erpnext/issues/39292)) ([d42db11](https://github.com/frappe/erpnext/commit/d42db1174d3f5ffd2f0517e2a39ae10ad05e4eec)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 0cfb47a1284..e640a99fdf8 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.60.1" +__version__ = "14.61.0" def get_default_company(user=None): From 26ca27a431dcd34e568b28c2407ad2599f59179d Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Tue, 23 Jan 2024 11:54:25 +0000 Subject: [PATCH 12/39] chore(release): Bumped to Version 14.61.1 ## [14.61.1](https://github.com/frappe/erpnext/compare/v14.61.0...v14.61.1) (2024-01-23) ### Bug Fixes * linting issue ([6895b74](https://github.com/frappe/erpnext/commit/6895b74ecc952f059e4eb05e67863bafd7139ce0)) * party field in pdf html ([a19b41d](https://github.com/frappe/erpnext/commit/a19b41d8c85a0f364d7f3704851b79bd9b88da5a)) * set unallocated amount after base tax ([f7ba736](https://github.com/frappe/erpnext/commit/f7ba7361ca6ebfc0876334e3ecdd54da564cf352)) * UOM needs to be whole number not being checked in quotations ([55c9cc3](https://github.com/frappe/erpnext/commit/55c9cc3f26409faf80298a6e69305db145d6bd01)) * use most reliable section reference per report line ([3bdff18](https://github.com/frappe/erpnext/commit/3bdff18467a575e4378fd625eebf6a2a666031cb)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index e640a99fdf8..c4d42e2b11c 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.61.0" +__version__ = "14.61.1" def get_default_company(user=None): From e729972987ddcb2e78edad2ae729b765fda12266 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Sat, 27 Jan 2024 10:12:37 +0530 Subject: [PATCH 13/39] fix: incorrect amount in the material request item (backport #39567) (backport #39568) (#39586) fix: incorrect amount in the material request item (backport #39567) (#39568) fix: incorrect amount in the material request item (#39567) fix: incoorect amount in the material request (cherry picked from commit 2bdfdeeb9a5f2fd98cf67fc983a920790e56e1e1) Co-authored-by: rohitwaghchaure (cherry picked from commit c26f7bbed0160a533c782d44410001c5fcab9913) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- erpnext/stock/doctype/material_request/material_request.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/erpnext/stock/doctype/material_request/material_request.js b/erpnext/stock/doctype/material_request/material_request.js index 5922af25879..e501fbba0e4 100644 --- a/erpnext/stock/doctype/material_request/material_request.js +++ b/erpnext/stock/doctype/material_request/material_request.js @@ -514,6 +514,13 @@ erpnext.buying.MaterialRequestController = class MaterialRequestController exten schedule_date() { set_schedule_date(this.frm); } + + qty(doc, cdt, cdn) { + var row = frappe.get_doc(cdt, cdn); + row.amount = flt(row.qty) * flt(row.rate); + frappe.model.set_value(cdt, cdn, "amount", row.amount); + refresh_field("amount", row.name, row.parentfield); + } }; // for backward compatibility: combine new and previous states From 33b21a54f7cf6990a965a91736b58c2bef99e65f Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Sat, 27 Jan 2024 04:43:52 +0000 Subject: [PATCH 14/39] chore(release): Bumped to Version 14.61.2 ## [14.61.2](https://github.com/frappe/erpnext/compare/v14.61.1...v14.61.2) (2024-01-27) ### Bug Fixes * incorrect amount in the material request item (backport [#39567](https://github.com/frappe/erpnext/issues/39567)) (backport [#39568](https://github.com/frappe/erpnext/issues/39568)) ([#39586](https://github.com/frappe/erpnext/issues/39586)) ([e729972](https://github.com/frappe/erpnext/commit/e729972987ddcb2e78edad2ae729b765fda12266)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index c4d42e2b11c..15f872b033d 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.61.1" +__version__ = "14.61.2" def get_default_company(user=None): From d794502681d29f628cc51789f32565ab749313e3 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 29 Jan 2024 18:57:40 +0530 Subject: [PATCH 15/39] fix amount not updated when change rate in material request (backport #39606) (backport #39614) (#39621) fix amount not updated when change rate in material request (backport #39606) (#39614) fix amount not updated when change rate in material request (#39606) * fix amount not updated when change rate in material request * make code consistent (cherry picked from commit efade9b9aee13c4702c69841cdb6766f305d5b30) Co-authored-by: Jeffry Suryadharma <41689493+jeffrysurya@users.noreply.github.com> (cherry picked from commit 2389b41f51d61bd3b79b6b2014be20865737e130) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- erpnext/stock/doctype/material_request/material_request.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/erpnext/stock/doctype/material_request/material_request.js b/erpnext/stock/doctype/material_request/material_request.js index e501fbba0e4..675a3e978c0 100644 --- a/erpnext/stock/doctype/material_request/material_request.js +++ b/erpnext/stock/doctype/material_request/material_request.js @@ -429,6 +429,9 @@ frappe.ui.form.on("Material Request Item", { rate: function(frm, doctype, name) { const item = locals[doctype][name]; + item.amount = flt(item.qty) * flt(item.rate); + frappe.model.set_value(doctype, name, "amount", item.amount); + refresh_field("amount", item.name, item.parentfield); frm.events.get_item_data(frm, item, false); }, From b7d8bfc58c4e7fd7ab7e32814730493fcaa91781 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Tue, 30 Jan 2024 14:14:00 +0000 Subject: [PATCH 16/39] chore(release): Bumped to Version 14.61.3 ## [14.61.3](https://github.com/frappe/erpnext/compare/v14.61.2...v14.61.3) (2024-01-30) ### Bug Fixes * Asset Depreciation WDV as per Income Tax Act ([b840eb9](https://github.com/frappe/erpnext/commit/b840eb90ebf558d91471c8bd1c629bc15214b94c)) * asset module test cases ([f604798](https://github.com/frappe/erpnext/commit/f604798a45fce39cd5e41c6a0aca8d7240848cdb)) * **Batch:** reload doc after splitting ([c759406](https://github.com/frappe/erpnext/commit/c759406ebbe225fc4f1bb7d7b4050e0386055cb8)) * default enable closing stock balance (backport [#39551](https://github.com/frappe/erpnext/issues/39551)) ([#39553](https://github.com/frappe/erpnext/issues/39553)) ([1e32c62](https://github.com/frappe/erpnext/commit/1e32c6207e2d344b2ba43f8be42f952340eacba5)) * do not auto-populate item delivery date ([1e341f0](https://github.com/frappe/erpnext/commit/1e341f0ff62bfcef778d4f792da6c611ac041372)) * do not consider rejected warehouses in pick list ([#39539](https://github.com/frappe/erpnext/issues/39539)) ([f6725e4](https://github.com/frappe/erpnext/commit/f6725e43425043eaba7dcdd3cf3768a857a39ee6)) * do not delete batches implicitly ([9a5995a](https://github.com/frappe/erpnext/commit/9a5995a3e5f1ff806855f8b88a4dc0b0a3ce73a8)) * **ecom:** do not create a new contact if a contact already exists ([#39290](https://github.com/frappe/erpnext/issues/39290)) ([47c591c](https://github.com/frappe/erpnext/commit/47c591ccf16565ad20ac88d7ba7a45bd6c990690)) * email list for auto reorder material request ([780c069](https://github.com/frappe/erpnext/commit/780c069268084e6cb1b4bacde8cad98485e925d1)) * enqueue JV submission when more than 100 accounts ([66be3c5](https://github.com/frappe/erpnext/commit/66be3c551f4666651b32d78a4fb15cdeed75b189)) * fetch correct quantity and amount for grouped asset ([1dacb79](https://github.com/frappe/erpnext/commit/1dacb794415cdf138be3707dd95cabe5bff3e9f2)) * incorrect amount in the material request item (backport [#39567](https://github.com/frappe/erpnext/issues/39567)) ([#39568](https://github.com/frappe/erpnext/issues/39568)) ([c26f7bb](https://github.com/frappe/erpnext/commit/c26f7bbed0160a533c782d44410001c5fcab9913)) * linter issue ([941f882](https://github.com/frappe/erpnext/commit/941f8824e5f31f42b0f54182d790e8178c9511ab)) * not able to edit / change address from portal ([e3fdb6f](https://github.com/frappe/erpnext/commit/e3fdb6f55cabd34ee97b47b7f50c4aabac59ac06)) * not able to edit address through portal ([b310a55](https://github.com/frappe/erpnext/commit/b310a55727e16ce511173eef1acd6db49f720227)) * Payment Terms Status for Sales Order report should show all payment terms from order not only this comming from template ([2953959](https://github.com/frappe/erpnext/commit/295395918c3515f1ce6757a9ababab42a87d4800)) * perf issue while submitting stock entry (backport [#39634](https://github.com/frappe/erpnext/issues/39634)) ([#39641](https://github.com/frappe/erpnext/issues/39641)) ([3ee0555](https://github.com/frappe/erpnext/commit/3ee05551150fc5dd28f02e548ad2e505bfc2a29f)) * prevent extra transfer against inter transfer transaction (backport [#39213](https://github.com/frappe/erpnext/issues/39213)) ([#39595](https://github.com/frappe/erpnext/issues/39595)) ([bf61030](https://github.com/frappe/erpnext/commit/bf61030dab65e8fff4d6752e320257dacc555f75)) * qtn tests using delivery date ([c50988b](https://github.com/frappe/erpnext/commit/c50988b1bc8b6dbfbec80763e4ecb8a5bb45c38d)) * return doc obj after submit ([0472879](https://github.com/frappe/erpnext/commit/04728792f588cf84cdf53082b92cf0eff4a19f37)) * RM valuation rate in SCR ([#39541](https://github.com/frappe/erpnext/issues/39541)) ([9fd1692](https://github.com/frappe/erpnext/commit/9fd1692db2c1cf45b34273bdd984c37bab13d403)) * typo's and parameter changes ([41c074d](https://github.com/frappe/erpnext/commit/41c074d0bbca82b21fcd27b66adc84fa8a03c6b0)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 15f872b033d..a8d71f538f7 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.61.2" +__version__ = "14.61.3" def get_default_company(user=None): From 57cfce08ef2b24c4ef3f6629f0584e6e08c99991 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Fri, 2 Feb 2024 13:23:54 +0530 Subject: [PATCH 17/39] chore: flag for barcode scanner (cherry picked from commit f8ca5c5c8bf0783ffd525571d157d4e2d597c8e4) --- erpnext/public/js/utils/barcode_scanner.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/erpnext/public/js/utils/barcode_scanner.js b/erpnext/public/js/utils/barcode_scanner.js index f1b53cb0721..aadbb24cc04 100644 --- a/erpnext/public/js/utils/barcode_scanner.js +++ b/erpnext/public/js/utils/barcode_scanner.js @@ -1,6 +1,7 @@ erpnext.utils.BarcodeScanner = class BarcodeScanner { constructor(opts) { this.frm = opts.frm; + // frappe.flags.trigger_from_barcode_scanner is used for custom scripts // field from which to capture input of scanned data this.scan_field_name = opts.scan_field_name || "scan_barcode"; @@ -84,6 +85,7 @@ erpnext.utils.BarcodeScanner = class BarcodeScanner { update_table(data) { return new Promise(resolve => { let cur_grid = this.frm.fields_dict[this.items_table_name].grid; + frappe.flags.trigger_from_barcode_scanner = true; const {item_code, barcode, batch_no, serial_no, uom} = data; @@ -143,12 +145,14 @@ erpnext.utils.BarcodeScanner = class BarcodeScanner { revert_selector_flag() { frappe.flags.hide_serial_batch_dialog = false; + frappe.flags.trigger_from_barcode_scanner = false; } set_item(row, item_code, barcode, batch_no, serial_no) { return new Promise(resolve => { const increment = async (value = 1) => { const item_data = {item_code: item_code}; + frappe.flags.trigger_from_barcode_scanner = true; item_data[this.qty_field] = Number((row[this.qty_field] || 0)) + Number(value); await frappe.model.set_value(row.doctype, row.name, item_data); return value; From 33ae0fa2f4a7fefff85198f3a1faf62be6e0e833 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 5 Feb 2024 17:38:00 +0530 Subject: [PATCH 18/39] fix: correctly calculate diff amount for included taxes (#39655) fix: correctly calculate diff amount for included taxes (#39655) (cherry picked from commit 772f540bef28117c008512ead6558db801d395cd) (cherry picked from commit 350b2cdde39c2c318f286bc01c54ebdb681e8a2d) Co-authored-by: Gursheen Kaur Anand <40693548+GursheenK@users.noreply.github.com> --- .../doctype/payment_entry/payment_entry.py | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py index 66c82be596c..b89854b172a 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -874,19 +874,19 @@ class PaymentEntry(AccountsController): ) base_party_amount = flt(self.base_total_allocated_amount) + flt(base_unallocated_amount) - - if self.payment_type == "Receive": - self.difference_amount = base_party_amount - self.base_received_amount - elif self.payment_type == "Pay": - self.difference_amount = self.base_paid_amount - base_party_amount - else: - self.difference_amount = self.base_paid_amount - flt(self.base_received_amount) - - total_deductions = sum(flt(d.amount) for d in self.get("deductions")) included_taxes = self.get_included_taxes() + if self.payment_type == "Receive": + self.difference_amount = base_party_amount - self.base_received_amount + included_taxes + elif self.payment_type == "Pay": + self.difference_amount = self.base_paid_amount - base_party_amount - included_taxes + else: + self.difference_amount = self.base_paid_amount - flt(self.base_received_amount) - included_taxes + + total_deductions = sum(flt(d.amount) for d in self.get("deductions")) + self.difference_amount = flt( - self.difference_amount - total_deductions - included_taxes, self.precision("difference_amount") + self.difference_amount - total_deductions, self.precision("difference_amount") ) def get_included_taxes(self): From 99929e94342a6ee2337abed6572b7853f10c716d Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Mon, 5 Feb 2024 12:09:13 +0000 Subject: [PATCH 19/39] chore(release): Bumped to Version 14.61.4 ## [14.61.4](https://github.com/frappe/erpnext/compare/v14.61.3...v14.61.4) (2024-02-05) ### Bug Fixes * correctly calculate diff amount for included taxes ([#39655](https://github.com/frappe/erpnext/issues/39655)) ([33ae0fa](https://github.com/frappe/erpnext/commit/33ae0fa2f4a7fefff85198f3a1faf62be6e0e833)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index a8d71f538f7..01144b8e109 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.61.3" +__version__ = "14.61.4" def get_default_company(user=None): From 9a8a9568b1944ed473e54a8dff753ae062a758bb Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Tue, 6 Feb 2024 18:44:23 +0000 Subject: [PATCH 20/39] chore(release): Bumped to Version 14.62.0 # [14.62.0](https://github.com/frappe/erpnext/compare/v14.61.4...v14.62.0) (2024-02-06) ### Bug Fixes * Blanket Order Ordered Quantity (backport [#39725](https://github.com/frappe/erpnext/issues/39725)) ([#39738](https://github.com/frappe/erpnext/issues/39738)) ([44c09de](https://github.com/frappe/erpnext/commit/44c09de7298005651c09e62ba578b7a8126e80ef)) * correctly calculate diff amount for included taxes ([#39655](https://github.com/frappe/erpnext/issues/39655)) ([350b2cd](https://github.com/frappe/erpnext/commit/350b2cdde39c2c318f286bc01c54ebdb681e8a2d)) * don't overwrite existing terms in transaction ([#39519](https://github.com/frappe/erpnext/issues/39519)) ([e49f8d5](https://github.com/frappe/erpnext/commit/e49f8d5f55b0cafda012475e94d48e11577a86e4)) * Exchange rate on MR to PO creation for muticurrency POs ([#39646](https://github.com/frappe/erpnext/issues/39646)) ([4dc5d9a](https://github.com/frappe/erpnext/commit/4dc5d9a6cad5f353867a96ccd3b4d6eaee34dcf9)) * incorrect landed cost voucher amount ([4a609d8](https://github.com/frappe/erpnext/commit/4a609d8fa8b8f0688e883382181c80063a7cdc1f)) * remove applied pricing rule on qty change (backport [#39688](https://github.com/frappe/erpnext/issues/39688)) ([#39736](https://github.com/frappe/erpnext/issues/39736)) ([46ac4f4](https://github.com/frappe/erpnext/commit/46ac4f471423ff652510e582f7a3e59141db2f02)) * show warehouse title field in sales docs (backport [#39746](https://github.com/frappe/erpnext/issues/39746)) ([#39754](https://github.com/frappe/erpnext/issues/39754)) ([a6067c6](https://github.com/frappe/erpnext/commit/a6067c623957123753dd64b5a1b6581280587a99)) ### Features * copy emails from lead to customer ([#38647](https://github.com/frappe/erpnext/issues/38647)) ([7952bf4](https://github.com/frappe/erpnext/commit/7952bf43187c88b1c5ce5fd4a84ec45f526d72a2)) * New financial views - Growth and margin views for P&L and balance sheet (backport [#39588](https://github.com/frappe/erpnext/issues/39588)) ([#39601](https://github.com/frappe/erpnext/issues/39601)) ([3808ddb](https://github.com/frappe/erpnext/commit/3808ddbf860d9b5e88f544bb6a2108b22aaaca5c)) ### Performance Improvements * memory consumption for the stock balance report ([#39626](https://github.com/frappe/erpnext/issues/39626)) ([b32848d](https://github.com/frappe/erpnext/commit/b32848d69dfb6614b013eca0df328e7923523a21)) * Move dimension validation out of GL Entry doctype ([#39730](https://github.com/frappe/erpnext/issues/39730)) ([7691256](https://github.com/frappe/erpnext/commit/7691256f4df404ca94f826feb2bc05f280b2857a)) * timeout for auto material request through reorder level ([85e6b39](https://github.com/frappe/erpnext/commit/85e6b39e23ae468e88eb49af9f5981ac854a5ac3)) * timeout while submitting the purchase receipt entry ([a1a70bb](https://github.com/frappe/erpnext/commit/a1a70bbae0723f3543f44daeaf675a0989061d76)) ### Reverts * Revert "feat: New financial views - Growth and margin views for P&L and balance sheet (#39588)" ([f01308b](https://github.com/frappe/erpnext/commit/f01308b97288ac630bf9221df897f13071183b24)), closes [#39588](https://github.com/frappe/erpnext/issues/39588) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 01144b8e109..181e366135b 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.61.4" +__version__ = "14.62.0" def get_default_company(user=None): From a4e6c388cb7838ad1f3c497c315a0fefa4e10f06 Mon Sep 17 00:00:00 2001 From: Gursheen Anand Date: Wed, 7 Feb 2024 18:46:07 +0530 Subject: [PATCH 21/39] fix: remove duplicates from tax category map (cherry picked from commit c56f3a58ab31aaecee2b4007aac53d10f6e73473) --- .../tds_payable_monthly.py | 10 +-- .../test_tds_payable_monthly.py | 89 +++++++++++++++---- 2 files changed, 74 insertions(+), 25 deletions(-) diff --git a/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py b/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py index b96bfbeb817..ba5cdbe6567 100644 --- a/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py +++ b/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py @@ -63,16 +63,14 @@ def get_result( tax_amount += entry.credit - entry.debit # infer tax withholding category from the account if it's the single account for this category tax_withholding_category = tds_accounts.get(entry.account) - rate = tax_rate_map.get(tax_withholding_category) # or else the consolidated value from the voucher document if not tax_withholding_category: - # or else from the party default tax_withholding_category = tax_category_map.get(name) - rate = tax_rate_map.get(tax_withholding_category) + # or else from the party default if not tax_withholding_category: tax_withholding_category = party_map.get(party, {}).get("tax_withholding_category") - rate = tax_rate_map.get(tax_withholding_category) + rate = tax_rate_map.get(tax_withholding_category) if net_total_map.get(name): if voucher_type == "Journal Entry" and tax_amount and rate: # back calcalute total amount from rate and tax_amount @@ -295,7 +293,7 @@ def get_tds_docs(filters): tds_accounts = {} for tds_acc in _tds_accounts: # if it turns out not to be the only tax withholding category, then don't include in the map - if tds_accounts.get(tds_acc["account"]): + if tds_acc["account"] in tds_accounts: tds_accounts[tds_acc["account"]] = None else: tds_accounts[tds_acc["account"]] = tds_acc["parent"] @@ -408,7 +406,7 @@ def get_doc_info(vouchers, doctype, tax_category_map, net_total_map=None): "paid_amount_after_tax", "base_paid_amount", ], - "Journal Entry": ["tax_withholding_category", "total_amount"], + "Journal Entry": ["total_amount"], } entries = frappe.get_all( diff --git a/erpnext/accounts/report/tds_payable_monthly/test_tds_payable_monthly.py b/erpnext/accounts/report/tds_payable_monthly/test_tds_payable_monthly.py index 89ecef1904c..f36b7ef1906 100644 --- a/erpnext/accounts/report/tds_payable_monthly/test_tds_payable_monthly.py +++ b/erpnext/accounts/report/tds_payable_monthly/test_tds_payable_monthly.py @@ -5,7 +5,6 @@ import frappe from frappe.tests.utils import FrappeTestCase from frappe.utils import today -from erpnext.accounts.doctype.cost_center.test_cost_center import create_cost_center from erpnext.accounts.doctype.payment_entry.test_payment_entry import create_payment_entry from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice @@ -22,18 +21,42 @@ class TestTdsPayableMonthly(AccountsTestMixin, FrappeTestCase): self.create_company() self.clear_old_entries() create_tax_accounts() - create_tcs_category() def test_tax_withholding_for_customers(self): + create_tax_category(cumulative_threshold=300) + frappe.db.set_value("Customer", "_Test Customer", "tax_withholding_category", "TCS") si = create_sales_invoice(rate=1000) pe = create_tcs_payment_entry() + jv = create_tcs_journal_entry() + filters = frappe._dict( company="_Test Company", party_type="Customer", from_date=today(), to_date=today() ) result = execute(filters)[1] expected_values = [ + # Check for JV totals using back calculation logic + [jv.name, "TCS", 0.075, -10000.0, -7.5, -10000.0], [pe.name, "TCS", 0.075, 2550, 0.53, 2550.53], - [si.name, "TCS", 0.075, 1000, 0.53, 1000.53], + [si.name, "TCS", 0.075, 1000, 0.52, 1000.52], + ] + self.check_expected_values(result, expected_values) + + def test_single_account_for_multiple_categories(self): + create_tax_category("TDS - 1", rate=10, account="TDS - _TC") + inv_1 = make_purchase_invoice(rate=1000, do_not_submit=True) + inv_1.tax_withholding_category = "TDS - 1" + inv_1.submit() + + create_tax_category("TDS - 2", rate=20, account="TDS - _TC") + inv_2 = make_purchase_invoice(rate=1000, do_not_submit=True) + inv_2.tax_withholding_category = "TDS - 2" + inv_2.submit() + result = execute( + frappe._dict(company="_Test Company", party_type="Supplier", from_date=today(), to_date=today()) + )[1] + expected_values = [ + [inv_1.name, "TDS - 1", 10, 5000, 500, 5500], + [inv_2.name, "TDS - 2", 20, 5000, 1000, 6000], ] self.check_expected_values(result, expected_values) @@ -41,12 +64,15 @@ class TestTdsPayableMonthly(AccountsTestMixin, FrappeTestCase): for i in range(len(result)): voucher = frappe._dict(result[i]) voucher_expected_values = expected_values[i] - self.assertEqual(voucher.ref_no, voucher_expected_values[0]) - self.assertEqual(voucher.section_code, voucher_expected_values[1]) - self.assertEqual(voucher.rate, voucher_expected_values[2]) - self.assertEqual(voucher.base_total, voucher_expected_values[3]) - self.assertEqual(voucher.tax_amount, voucher_expected_values[4]) - self.assertEqual(voucher.grand_total, voucher_expected_values[5]) + voucher_actual_values = ( + voucher.ref_no, + voucher.section_code, + voucher.rate, + voucher.base_total, + voucher.tax_amount, + voucher.grand_total, + ) + self.assertSequenceEqual(voucher_actual_values, voucher_expected_values) def tearDown(self): self.clear_old_entries() @@ -67,24 +93,20 @@ def create_tax_accounts(): ).insert(ignore_if_duplicate=True) -def create_tcs_category(): +def create_tax_category(category="TCS", rate=0.075, account="TCS - _TC", cumulative_threshold=0): fiscal_year = get_fiscal_year(today(), company="_Test Company") from_date = fiscal_year[1] to_date = fiscal_year[2] - tax_category = create_tax_withholding_category( - category_name="TCS", - rate=0.075, + create_tax_withholding_category( + category_name=category, + rate=rate, from_date=from_date, to_date=to_date, - account="TCS - _TC", - cumulative_threshold=300, + account=account, + cumulative_threshold=cumulative_threshold, ) - customer = frappe.get_doc("Customer", "_Test Customer") - customer.tax_withholding_category = "TCS" - customer.save() - def create_tcs_payment_entry(): payment_entry = create_payment_entry( @@ -109,3 +131,32 @@ def create_tcs_payment_entry(): ) payment_entry.submit() return payment_entry + + +def create_tcs_journal_entry(): + jv = frappe.new_doc("Journal Entry") + jv.posting_date = today() + jv.company = "_Test Company" + jv.set( + "accounts", + [ + { + "account": "Debtors - _TC", + "party_type": "Customer", + "party": "_Test Customer", + "credit_in_account_currency": 10000, + }, + { + "account": "Debtors - _TC", + "party_type": "Customer", + "party": "_Test Customer", + "debit_in_account_currency": 9992.5, + }, + { + "account": "TCS - _TC", + "debit_in_account_currency": 7.5, + }, + ], + ) + jv.insert() + return jv.submit() From 79479b633fd9255aacddd60de456b7ee55439c01 Mon Sep 17 00:00:00 2001 From: Gursheen Anand Date: Wed, 7 Feb 2024 19:12:32 +0530 Subject: [PATCH 22/39] fix: accommodate for default rounding method in v14 (cherry picked from commit d6a758d1f4c751f7be83197e677638bb0db80596) --- .../report/tds_payable_monthly/test_tds_payable_monthly.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/report/tds_payable_monthly/test_tds_payable_monthly.py b/erpnext/accounts/report/tds_payable_monthly/test_tds_payable_monthly.py index f36b7ef1906..742d2f37c45 100644 --- a/erpnext/accounts/report/tds_payable_monthly/test_tds_payable_monthly.py +++ b/erpnext/accounts/report/tds_payable_monthly/test_tds_payable_monthly.py @@ -37,7 +37,7 @@ class TestTdsPayableMonthly(AccountsTestMixin, FrappeTestCase): # Check for JV totals using back calculation logic [jv.name, "TCS", 0.075, -10000.0, -7.5, -10000.0], [pe.name, "TCS", 0.075, 2550, 0.53, 2550.53], - [si.name, "TCS", 0.075, 1000, 0.52, 1000.52], + [si.name, "TCS", 0.075, 1000.0, 0.53, 1000.53], ] self.check_expected_values(result, expected_values) From 596c9fd5076163b82aa35a03caab56c510fd17ca Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 7 Feb 2024 21:00:18 +0530 Subject: [PATCH 23/39] fix: incorrect planned qty in PP (backport #39785) (backport #39792) (#39795) fix: incorrect planned qty in PP (backport #39785) (#39792) fix: incorrect planned qty in PP (cherry picked from commit a8ebc94a366e8f15e9bbeab3da064cf5f22dd1b9) Co-authored-by: s-aga-r (cherry picked from commit df9d52d3ce7155fb7f917383c7d795769aed1c15) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- .../doctype/production_plan/production_plan.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.py b/erpnext/manufacturing/doctype/production_plan/production_plan.py index c98d639663a..6ccd11bf9ff 100644 --- a/erpnext/manufacturing/doctype/production_plan/production_plan.py +++ b/erpnext/manufacturing/doctype/production_plan/production_plan.py @@ -236,9 +236,10 @@ class ProductionPlan(Document): so_item.parent, so_item.item_code, so_item.warehouse, - ( - (so_item.qty - so_item.work_order_qty - so_item.delivered_qty) * so_item.conversion_factor - ).as_("pending_qty"), + so_item.qty, + so_item.work_order_qty, + so_item.delivered_qty, + so_item.conversion_factor, so_item.description, so_item.name, so_item.bom_no, @@ -261,6 +262,11 @@ class ProductionPlan(Document): items = items_query.run(as_dict=True) + for item in items: + item.pending_qty = ( + flt(item.qty) - max(item.work_order_qty, item.delivered_qty, 0) * item.conversion_factor + ) + pi = frappe.qb.DocType("Packed Item") packed_items_query = ( From 7413c8b0a9e3ee0c692bcf70502af1899e031129 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 7 Feb 2024 15:31:34 +0000 Subject: [PATCH 24/39] chore(release): Bumped to Version 14.62.1 ## [14.62.1](https://github.com/frappe/erpnext/compare/v14.62.0...v14.62.1) (2024-02-07) ### Bug Fixes * incorrect planned qty in PP (backport [#39785](https://github.com/frappe/erpnext/issues/39785)) (backport [#39792](https://github.com/frappe/erpnext/issues/39792)) ([#39795](https://github.com/frappe/erpnext/issues/39795)) ([596c9fd](https://github.com/frappe/erpnext/commit/596c9fd5076163b82aa35a03caab56c510fd17ca)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 181e366135b..1b177e1e0cc 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.62.0" +__version__ = "14.62.1" def get_default_company(user=None): From 5c59ab5975229ce36cecd6f655f61a5f246bae34 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 7 Feb 2024 16:32:23 +0530 Subject: [PATCH 25/39] refactor: cancel Cr/Dr JE's on Sales/Purchase return cancel (cherry picked from commit 0549535603cae6a7afbd3375c8dd62b517af3c6e) --- erpnext/controllers/accounts_controller.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index a3f48141aac..2420d987c23 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -1374,6 +1374,24 @@ class AccountsController(TransactionBase): x.update({dim.fieldname: self.get(dim.fieldname)}) reconcile_against_document(lst, active_dimensions=active_dimensions) + def cancel_system_generated_credit_debit_notes(self): + # Cancel 'Credit/Debit' Note Journal Entries, if found. + if self.doctype in ["Sales Invoice", "Purchase Invoice"]: + voucher_type = "Credit Note" if self.doctype == "Sales Invoice" else "Debit Note" + journals = frappe.db.get_all( + "Journal Entry", + filters={ + "is_system_generated": 1, + "reference_type": self.doctype, + "reference_name": self.name, + "voucher_type": voucher_type, + "docstatus": 1, + }, + pluck="name", + ) + for x in journals: + frappe.get_doc("Journal Entry", x).cancel() + def on_cancel(self): from erpnext.accounts.doctype.bank_transaction.bank_transaction import ( remove_from_bank_transaction, @@ -1386,6 +1404,8 @@ class AccountsController(TransactionBase): remove_from_bank_transaction(self.doctype, self.name) if self.doctype in ["Sales Invoice", "Purchase Invoice", "Payment Entry", "Journal Entry"]: + self.cancel_system_generated_credit_debit_notes() + # Cancel Exchange Gain/Loss Journal before unlinking cancel_exchange_gain_loss_journal(self) From c419c1de06114ef8fa442d49dadb3cbc7dfd8b04 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 7 Feb 2024 17:21:29 +0530 Subject: [PATCH 26/39] test: Invoice status on Cr/Dr note cancellation (cherry picked from commit 31a8c3bdc45f0e32a51e43260db8484e5f17aa75) --- .../test_payment_reconciliation.py | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py b/erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py index d7a73f0ce71..89240ac0d8a 100644 --- a/erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py +++ b/erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py @@ -591,6 +591,66 @@ class TestPaymentReconciliation(FrappeTestCase): self.assertEqual(si.status, "Paid") self.assertEqual(si.outstanding_amount, 0) + def test_invoice_status_after_cr_note_cancellation(self): + # This test case is made after the 'always standalone Credit/Debit notes' feature is introduced + transaction_date = nowdate() + amount = 100 + + si = self.create_sales_invoice(qty=1, rate=amount, posting_date=transaction_date) + + cr_note = self.create_sales_invoice( + qty=-1, rate=amount, posting_date=transaction_date, do_not_save=True, do_not_submit=True + ) + cr_note.is_return = 1 + cr_note.return_against = si.name + cr_note = cr_note.save().submit() + + pr = self.create_payment_reconciliation() + + pr.get_unreconciled_entries() + invoices = [x.as_dict() for x in pr.get("invoices")] + payments = [x.as_dict() for x in pr.get("payments")] + pr.allocate_entries(frappe._dict({"invoices": invoices, "payments": payments})) + pr.reconcile() + + pr.get_unreconciled_entries() + self.assertEqual(pr.get("invoices"), []) + self.assertEqual(pr.get("payments"), []) + + journals = frappe.db.get_all( + "Journal Entry", + filters={ + "is_system_generated": 1, + "docstatus": 1, + "voucher_type": "Credit Note", + "reference_type": si.doctype, + "reference_name": si.name, + }, + pluck="name", + ) + self.assertEqual(len(journals), 1) + + # assert status outstanding + si.reload() + self.assertEqual(si.status, "Credit Note Issued") + self.assertEqual(si.outstanding_amount, 0) + + cr_note.reload() + cr_note.cancel() + # 'Credit Note' Journal should be auto cancelled + journals = frappe.db.get_all( + "Journal Entry", + filters={ + "is_system_generated": 1, + "docstatus": 1, + "voucher_type": "Credit Note", + "reference_type": si.doctype, + "reference_name": si.name, + }, + pluck="name", + ) + self.assertEqual(len(journals), 0) + def test_cr_note_partial_against_invoice(self): transaction_date = nowdate() amount = 100 From 129ab38fba27f915c47ccce1eecbcbe29c7d0e12 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 7 Feb 2024 17:33:55 +0530 Subject: [PATCH 27/39] refactor(test): assert Invoice status as well (cherry picked from commit 33efe0d12d85484e551dc9ebebf8840d427ecc67) --- .../payment_reconciliation/test_payment_reconciliation.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py b/erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py index 89240ac0d8a..fb75a0f7caf 100644 --- a/erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py +++ b/erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py @@ -630,7 +630,7 @@ class TestPaymentReconciliation(FrappeTestCase): ) self.assertEqual(len(journals), 1) - # assert status outstanding + # assert status and outstanding si.reload() self.assertEqual(si.status, "Credit Note Issued") self.assertEqual(si.outstanding_amount, 0) @@ -650,6 +650,10 @@ class TestPaymentReconciliation(FrappeTestCase): pluck="name", ) self.assertEqual(len(journals), 0) + # assert status and outstanding + si.reload() + self.assertEqual(si.status, "Unpaid") + self.assertEqual(si.outstanding_amount, 100) def test_cr_note_partial_against_invoice(self): transaction_date = nowdate() From 8888ce196df86dc850fe9287cc84611a2aedcced Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 7 Feb 2024 19:59:33 +0530 Subject: [PATCH 28/39] refactor(test): Forex Credit Note cancellation against Invoice (cherry picked from commit 2f676ced5c712823c5737f40230ec8b1994cd2dd) --- .../controllers/tests/test_accounts_controller.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/erpnext/controllers/tests/test_accounts_controller.py b/erpnext/controllers/tests/test_accounts_controller.py index 5e3077ea8c8..0c9d34d82a2 100644 --- a/erpnext/controllers/tests/test_accounts_controller.py +++ b/erpnext/controllers/tests/test_accounts_controller.py @@ -1108,18 +1108,18 @@ class TestAccountsController(FrappeTestCase): cr_note.reload() cr_note.cancel() - # Exchange Gain/Loss Journal should've been created. + # with the introduction of 'cancel_system_generated_credit_debit_notes' in accounts controller + # JE(Credit Note) will be cancelled once the parent is cancelled exc_je_for_si = self.get_journals_for(si.doctype, si.name) exc_je_for_cr = self.get_journals_for(cr_note.doctype, cr_note.name) - self.assertNotEqual(exc_je_for_si, []) - self.assertEqual(len(exc_je_for_si), 1) + self.assertEqual(exc_je_for_si, []) + self.assertEqual(len(exc_je_for_si), 0) self.assertEqual(len(exc_je_for_cr), 0) - # The Credit Note JE is still active and is referencing the sales invoice - # So, outstanding stays the same + # No references, full outstanding si.reload() - self.assertEqual(si.outstanding_amount, 1) - self.assert_ledger_outstanding(si.doctype, si.name, 80.0, 1.0) + self.assertEqual(si.outstanding_amount, 2) + self.assert_ledger_outstanding(si.doctype, si.name, 160.0, 2.0) def test_40_cost_center_from_payment_entry(self): """ From 0822a2b40af8f2052c037e552e5d8ce8140df75d Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Thu, 8 Feb 2024 07:28:09 +0000 Subject: [PATCH 29/39] chore(release): Bumped to Version 14.62.2 ## [14.62.2](https://github.com/frappe/erpnext/compare/v14.62.1...v14.62.2) (2024-02-08) ### Bug Fixes * accommodate for default rounding method in v14 ([79479b6](https://github.com/frappe/erpnext/commit/79479b633fd9255aacddd60de456b7ee55439c01)) * remove duplicates from tax category map ([a4e6c38](https://github.com/frappe/erpnext/commit/a4e6c388cb7838ad1f3c497c315a0fefa4e10f06)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 1b177e1e0cc..5b40c6d60fd 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.62.1" +__version__ = "14.62.2" def get_default_company(user=None): From d6054dbdbda69ac830e6123a3bc5ca220c108d0e Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 8 Feb 2024 14:18:50 +0530 Subject: [PATCH 30/39] fix: do not throw validation for canceled SLE (backport #39769) (#39810) fix: do not throw validation for cancelled sle (cherry picked from commit 32ccf3524ad973b1bc8c5c7eefa4c79f5d8b4444) Co-authored-by: Rohit Waghchaure (cherry picked from commit 2885b8fa44b70270be92706b45b02f36405868ea) --- erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py b/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py index 1d52b17149b..9580e83ed95 100644 --- a/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py +++ b/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py @@ -53,6 +53,9 @@ class StockLedgerEntry(Document): self.validate_inventory_dimension_negative_stock() def validate_inventory_dimension_negative_stock(self): + if self.is_cancelled: + return + extra_cond = "" kwargs = {} From 8caf6555294f2799fc8fa89ed14e5c9309b8a0dc Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Thu, 8 Feb 2024 09:12:55 +0000 Subject: [PATCH 31/39] chore(release): Bumped to Version 14.62.3 ## [14.62.3](https://github.com/frappe/erpnext/compare/v14.62.2...v14.62.3) (2024-02-08) ### Bug Fixes * do not throw validation for canceled SLE (backport [#39769](https://github.com/frappe/erpnext/issues/39769)) ([#39810](https://github.com/frappe/erpnext/issues/39810)) ([d6054db](https://github.com/frappe/erpnext/commit/d6054dbdbda69ac830e6123a3bc5ca220c108d0e)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 5b40c6d60fd..3847833443a 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.62.2" +__version__ = "14.62.3" def get_default_company(user=None): From 22ace5cb5a5b2350df685587f20b3a7b948c5548 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 14 Feb 2024 12:06:19 +0000 Subject: [PATCH 32/39] chore(release): Bumped to Version 14.62.4 ## [14.62.4](https://github.com/frappe/erpnext/compare/v14.62.3...v14.62.4) (2024-02-14) ### Bug Fixes * production plan issue with sales order (backport [#39901](https://github.com/frappe/erpnext/issues/39901)) ([#39903](https://github.com/frappe/erpnext/issues/39903)) ([ab7e323](https://github.com/frappe/erpnext/commit/ab7e323648169e5115b05b28b66d5b6859ff3925)) * accommodate for default rounding method in v14 ([d6a758d](https://github.com/frappe/erpnext/commit/d6a758d1f4c751f7be83197e677638bb0db80596)) * broken route option in Profitability report ([f79e0d1](https://github.com/frappe/erpnext/commit/f79e0d1e37d167ac817c2ef48c35343978c2c3b7)) * calculate `stock_value_diff` ([8f58b61](https://github.com/frappe/erpnext/commit/8f58b613e4585623087d59585016057b05a71579)) * cancel asset capitalization ([2438600](https://github.com/frappe/erpnext/commit/24386006d695123bbb02f3a976790f7fcffe7635)) * do not throw validation for canceled SLE (backport [#39769](https://github.com/frappe/erpnext/issues/39769)) ([#39810](https://github.com/frappe/erpnext/issues/39810)) ([2885b8f](https://github.com/frappe/erpnext/commit/2885b8fa44b70270be92706b45b02f36405868ea)) * Handling circular linking while cancelling asset capitalization ([f2d094d](https://github.com/frappe/erpnext/commit/f2d094d1ab8df6af4bd07410f9a1e933e0cce98a)) * incorrect planned qty in PP (backport [#39785](https://github.com/frappe/erpnext/issues/39785)) ([#39792](https://github.com/frappe/erpnext/issues/39792)) ([df9d52d](https://github.com/frappe/erpnext/commit/df9d52d3ce7155fb7f917383c7d795769aed1c15)) * landed cost voucher not submitting because of incorrect reference (backport [#39898](https://github.com/frappe/erpnext/issues/39898)) ([#39899](https://github.com/frappe/erpnext/issues/39899)) ([d0b9c56](https://github.com/frappe/erpnext/commit/d0b9c568d3645ffa53dfe3e6589c5f2e3b6eff30)) * remove duplicates from tax category map ([c56f3a5](https://github.com/frappe/erpnext/commit/c56f3a58ab31aaecee2b4007aac53d10f6e73473)) * set rate for PO created against BO (backport [#39765](https://github.com/frappe/erpnext/issues/39765)) ([#39766](https://github.com/frappe/erpnext/issues/39766)) ([de47e67](https://github.com/frappe/erpnext/commit/de47e67dfacd7dabb4c935728a9d95df736343c9)) * set route options to cost center ([#37235](https://github.com/frappe/erpnext/issues/37235)) ([79a16ba](https://github.com/frappe/erpnext/commit/79a16bad156803bbf0298b6794b7e1301aad49bc)) * **ux:** set rate as price list rate on uom change in MR (backport [#39816](https://github.com/frappe/erpnext/issues/39816)) ([#39817](https://github.com/frappe/erpnext/issues/39817)) ([de6e8c7](https://github.com/frappe/erpnext/commit/de6e8c74c5873393385441deb1bffac8006c1f45)) ### Performance Improvements * cached get_last_purchase_details to fix performance issue (backport [#39854](https://github.com/frappe/erpnext/issues/39854)) ([#39855](https://github.com/frappe/erpnext/issues/39855)) ([08e0271](https://github.com/frappe/erpnext/commit/08e02710cda1057846bead48021548a537779fc4)) * production plan submission (backport [#39846](https://github.com/frappe/erpnext/issues/39846)) ([#39859](https://github.com/frappe/erpnext/issues/39859)) ([a61cffd](https://github.com/frappe/erpnext/commit/a61cffd7c20f7b3d0daf068c013bab09b0266e7a)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 3847833443a..a36b9c32636 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.62.3" +__version__ = "14.62.4" def get_default_company(user=None): From 8ab75560d5067fbb759d66b1b04ffdfcd38945bb Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 21 Feb 2024 05:30:04 +0000 Subject: [PATCH 33/39] chore(release): Bumped to Version 14.63.0 # [14.63.0](https://github.com/frappe/erpnext/compare/v14.62.4...v14.63.0) (2024-02-21) ### Bug Fixes * 'NoneType' object is not iterable (backport [#39977](https://github.com/frappe/erpnext/issues/39977)) ([#39980](https://github.com/frappe/erpnext/issues/39980)) ([8e71665](https://github.com/frappe/erpnext/commit/8e71665e4f19cddedc534c7e7996d76a6d83d0cc)) * Adjust amount in last row due to rounding ([963ddac](https://github.com/frappe/erpnext/commit/963ddac528daa6ac9694757af704282f9bd22262)) * **Bank Transaction:** precision for `(un)allocated_amount` ([cea0e1f](https://github.com/frappe/erpnext/commit/cea0e1fb91f8ae8a166af6615ed7878b885dd257)), closes [#39926](https://github.com/frappe/erpnext/issues/39926) * fetch company terms ([83bf286](https://github.com/frappe/erpnext/commit/83bf28616e33a34174ade3504dbfae8571f8e58c)) * group node in warehouse filter in Item-wise Sales Register ([4921b03](https://github.com/frappe/erpnext/commit/4921b038bdcfef61191bb31c97e6583a564f3589)) * **Issue:** create communication ([8deaba8](https://github.com/frappe/erpnext/commit/8deaba8defd483bf9027bd03c58154f01f20fb24)) * linter issue ([a4fbea3](https://github.com/frappe/erpnext/commit/a4fbea3722ef61e7d79e8158629e564f6f32487a)) * linter issue ([abceb1b](https://github.com/frappe/erpnext/commit/abceb1b6110953bca1609e739a0a835542b6b946)) * linter issues ([e99485b](https://github.com/frappe/erpnext/commit/e99485bfa7d78f99094b08d5147f02cc3921cb12)) * no need call for company method in sales invoice js ([45a0494](https://github.com/frappe/erpnext/commit/45a04943189c221a73f752257565cdd77c2f19ab)) * On cancelation of capitalization, reverse depreciation entry only if journal entry exists ([5b9905f](https://github.com/frappe/erpnext/commit/5b9905f27ab80dcc1b74b22d7dfa5eb52b710c2a)) * party item code in Blanket Order ([ee9a51f](https://github.com/frappe/erpnext/commit/ee9a51f93fef19b89b1d01a8f7de98237ddbefa2)) * reconciliation issue due to notation difference ([dcf19c3](https://github.com/frappe/erpnext/commit/dcf19c3ed918f18ade8e47b7a435650d0abd4280)) * show active bom in the dropdown while making stock entry and MR (backport [#39974](https://github.com/frappe/erpnext/issues/39974)) ([#39975](https://github.com/frappe/erpnext/issues/39975)) ([385b08d](https://github.com/frappe/erpnext/commit/385b08dc50ba27f00fd1e71f8e3156a813ca7219)) * typeerror 'Item Group' filter on Purchase Register ([b1a4249](https://github.com/frappe/erpnext/commit/b1a4249041b1834965cc719ac733423a198fe615)) * update_dimension is required and not need party account method ([5eaa11b](https://github.com/frappe/erpnext/commit/5eaa11b9e871048c286c278ad7601ddf4ef171bc)) * webpages are not showing ([#39988](https://github.com/frappe/erpnext/issues/39988)) ([64099b0](https://github.com/frappe/erpnext/commit/64099b0bf75ff6574a65e49be0f39feddeeedecb)) ### Features * New financial views - Growth and margin views for P&L and balance sheet ([d913ec5](https://github.com/frappe/erpnext/commit/d913ec52db9d90a8eae519e2dd2eaa5b657bb0c7)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index a36b9c32636..b6ba58052e5 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.62.4" +__version__ = "14.63.0" def get_default_company(user=None): From 7355fce75e9c5084e4583c6510e66702cce8e94e Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 22 Feb 2024 11:39:48 +0530 Subject: [PATCH 34/39] fix: negative stock error while making stock reconciliation (backport #40016) (#40025) * fix: negative stock error while making stock reconciliation (#40016) fix: negative stock error while making stock reco (cherry picked from commit da184d709b9f61bc9bd62cd6beddf5e19c661042) # Conflicts: # erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py * chore: fix conflicts * chore: fix linter issue --------- Co-authored-by: rohitwaghchaure (cherry picked from commit 865cba406f7826501e33853052d15665d6b72448) --- .../doctype/stock_reconciliation/stock_reconciliation.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py index 9a46ae71ad2..44c2d85b4cc 100644 --- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py +++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py @@ -699,8 +699,13 @@ class StockReconciliation(StockController): def has_negative_stock_allowed(self): allow_negative_stock = cint(frappe.db.get_single_value("Stock Settings", "allow_negative_stock")) + if allow_negative_stock: + return True - if all(d.batch_no and flt(d.qty) == flt(d.current_qty) for d in self.items): + if any( + (d.batch_no and flt(d.qty) == flt(d.current_qty)) + for d in self.items + ): allow_negative_stock = True return allow_negative_stock From 315d4dec90eb907cd2598724b5d7a4109bab5975 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Thu, 22 Feb 2024 08:18:35 +0000 Subject: [PATCH 35/39] chore(release): Bumped to Version 14.63.1 ## [14.63.1](https://github.com/frappe/erpnext/compare/v14.63.0...v14.63.1) (2024-02-22) ### Bug Fixes * negative stock error while making stock reconciliation (backport [#40016](https://github.com/frappe/erpnext/issues/40016)) ([#40025](https://github.com/frappe/erpnext/issues/40025)) ([7355fce](https://github.com/frappe/erpnext/commit/7355fce75e9c5084e4583c6510e66702cce8e94e)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index b6ba58052e5..aa35e62c842 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.63.0" +__version__ = "14.63.1" def get_default_company(user=None): From a40e41051986a8c1d8e38b9f2436deb15a3e54ef Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Thu, 22 Feb 2024 16:24:30 +0530 Subject: [PATCH 36/39] fix: Webpages not working without login (cherry picked from commit d6fad08d20c6d29e799a9dc43c75db4c0c6926fa) --- erpnext/setup/doctype/item_group/item_group.json | 4 +++- erpnext/setup/doctype/item_group/templates/item_group.html | 7 +++++++ .../setup/doctype/item_group/templates/item_group_row.html | 4 ++++ 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 erpnext/setup/doctype/item_group/templates/item_group.html create mode 100644 erpnext/setup/doctype/item_group/templates/item_group_row.html diff --git a/erpnext/setup/doctype/item_group/item_group.json b/erpnext/setup/doctype/item_group/item_group.json index 2986087277c..71dfdb4f91a 100644 --- a/erpnext/setup/doctype/item_group/item_group.json +++ b/erpnext/setup/doctype/item_group/item_group.json @@ -1,5 +1,6 @@ { "actions": [], + "allow_guest_to_view": 1, "allow_import": 1, "allow_rename": 1, "autoname": "field:item_group_name", @@ -227,13 +228,14 @@ "label": "Include Descendants" } ], + "has_web_view": 1, "icon": "fa fa-sitemap", "idx": 1, "image_field": "image", "is_tree": 1, "links": [], "max_attachments": 3, - "modified": "2023-01-05 12:21:30.458628", + "modified": "2024-02-22 16:23:46.936496", "modified_by": "Administrator", "module": "Setup", "name": "Item Group", diff --git a/erpnext/setup/doctype/item_group/templates/item_group.html b/erpnext/setup/doctype/item_group/templates/item_group.html new file mode 100644 index 00000000000..db123090aae --- /dev/null +++ b/erpnext/setup/doctype/item_group/templates/item_group.html @@ -0,0 +1,7 @@ +{% extends "templates/web.html" %} + +{% block page_content %} +

{{ title }}

+{% endblock %} + + \ No newline at end of file diff --git a/erpnext/setup/doctype/item_group/templates/item_group_row.html b/erpnext/setup/doctype/item_group/templates/item_group_row.html new file mode 100644 index 00000000000..d7014b453ab --- /dev/null +++ b/erpnext/setup/doctype/item_group/templates/item_group_row.html @@ -0,0 +1,4 @@ + + From 0653f6854bad89490a7665a9def0ae592e60abe1 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Thu, 22 Feb 2024 11:58:43 +0000 Subject: [PATCH 37/39] chore(release): Bumped to Version 14.63.2 ## [14.63.2](https://github.com/frappe/erpnext/compare/v14.63.1...v14.63.2) (2024-02-22) ### Bug Fixes * Webpages not working without login ([a40e410](https://github.com/frappe/erpnext/commit/a40e41051986a8c1d8e38b9f2436deb15a3e54ef)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index aa35e62c842..3e2d97eacc8 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.63.1" +__version__ = "14.63.2" def get_default_company(user=None): From 23e32b9b33e77ea3916e292c092cdfbedb9b309f Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 22 Feb 2024 18:29:56 +0530 Subject: [PATCH 38/39] fix: communication_date in party dashboards (backport #40005) (backport #40020) (#40044) fix: communication_date in party dashboards (backport #40005) (#40020) fix: accommodate for changed orderby statement (cherry picked from commit 87df7ff71772474bb858dac6ce9132280ce2ab82) Co-authored-by: Gursheen Anand (cherry picked from commit b364fe704723cfc0e508c8ff9f39645a8625b703) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- erpnext/accounts/party.py | 41 +++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py index c83969b34bc..8f8b9a81f8a 100644 --- a/erpnext/accounts/party.py +++ b/erpnext/accounts/party.py @@ -9,7 +9,7 @@ from frappe import _, msgprint, qb, scrub from frappe.contacts.doctype.address.address import get_company_address, get_default_address from frappe.core.doctype.user_permission.user_permission import get_permitted_documents from frappe.model.utils import get_fetch_values -from frappe.query_builder.functions import Abs, Date, Sum +from frappe.query_builder.functions import Abs, Count, Date, Sum from frappe.utils import ( add_days, add_months, @@ -761,34 +761,37 @@ def get_timeline_data(doctype, name): from frappe.desk.form.load import get_communication_data out = {} - fields = "creation, count(*)" after = add_years(None, -1).strftime("%Y-%m-%d") - group_by = "group by Date(creation)" data = get_communication_data( doctype, name, after=after, - group_by="group by creation", - fields="C.creation as creation, count(C.name)", + group_by="group by communication_date", + fields="C.communication_date as communication_date, count(C.name)", as_dict=False, ) # fetch and append data from Activity Log - data += frappe.db.sql( - """select {fields} - from `tabActivity Log` - where (reference_doctype=%(doctype)s and reference_name=%(name)s) - or (timeline_doctype in (%(doctype)s) and timeline_name=%(name)s) - or (reference_doctype in ("Quotation", "Opportunity") and timeline_name=%(name)s) - and status!='Success' and creation > {after} - {group_by} order by creation desc - """.format( - fields=fields, group_by=group_by, after=after - ), - {"doctype": doctype, "name": name}, - as_dict=False, - ) + activity_log = frappe.qb.DocType("Activity Log") + data += ( + frappe.qb.from_(activity_log) + .select(activity_log.communication_date, Count(activity_log.name)) + .where( + ( + ((activity_log.reference_doctype == doctype) & (activity_log.reference_name == name)) + | ((activity_log.timeline_doctype == doctype) & (activity_log.timeline_name == name)) + | ( + (activity_log.reference_doctype.isin(["Quotation", "Opportunity"])) + & (activity_log.timeline_name == name) + ) + ) + & (activity_log.status != "Success") + & (activity_log.creation > after) + ) + .groupby(activity_log.communication_date) + .orderby(activity_log.communication_date, order=frappe.qb.desc) + ).run() timeline_items = dict(data) From 95197c05329aa7df6d2314f49de1b3d4a6ccef68 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Thu, 22 Feb 2024 13:01:09 +0000 Subject: [PATCH 39/39] chore(release): Bumped to Version 14.63.3 ## [14.63.3](https://github.com/frappe/erpnext/compare/v14.63.2...v14.63.3) (2024-02-22) ### Bug Fixes * communication_date in party dashboards (backport [#40005](https://github.com/frappe/erpnext/issues/40005)) (backport [#40020](https://github.com/frappe/erpnext/issues/40020)) ([#40044](https://github.com/frappe/erpnext/issues/40044)) ([23e32b9](https://github.com/frappe/erpnext/commit/23e32b9b33e77ea3916e292c092cdfbedb9b309f)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 3e2d97eacc8..96f8ec27ec1 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.63.2" +__version__ = "14.63.3" def get_default_company(user=None):