From 6e01a9b84d2e0e8538b6dda5dbcadba65d9e65e4 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Thu, 12 Dec 2024 10:45:52 +0000 Subject: [PATCH 01/94] chore(release): Bumped to Version 15.45.5 ## [15.45.5](https://github.com/frappe/erpnext/compare/v15.45.4...v15.45.5) (2024-12-12) ### Bug Fixes * 'Use Multi-Level BOM' checkbox default value (backport [#44618](https://github.com/frappe/erpnext/issues/44618)) ([#44620](https://github.com/frappe/erpnext/issues/44620)) ([5cd3994](https://github.com/frappe/erpnext/commit/5cd39941ee9d8067e606df169b1d773fa46cc580)) * add docstatus for translation ([47e1ed1](https://github.com/frappe/erpnext/commit/47e1ed1eff0a14fef46881ac42843b43d5ce43d0)) * add label strings for translation in pos_controller.js ([ffdd7cf](https://github.com/frappe/erpnext/commit/ffdd7cfa8678ecb4880eb8c68d260673e3cbbc5d)) * add labels for translation in production_analytics.py ([7a6cb0f](https://github.com/frappe/erpnext/commit/7a6cb0f157adb8a0e582e2d2c6806a2acc2e8a32)) * add labels for translation in purchase_order_analysis.py ([f06827c](https://github.com/frappe/erpnext/commit/f06827c6fbdbbd74cf3c93a843a206e384cfdf5b)) * add labels for translation in quality_inspection_summary.py ([dd3a747](https://github.com/frappe/erpnext/commit/dd3a747af461a01b4fdafb877320460a85a864fe)) * add labels for translation in sales_order_analysis.py ([6980d1e](https://github.com/frappe/erpnext/commit/6980d1e142d25a3151ea5b12625a9f6e62e39352)) * add labels for translation in sales_order.js ([283043e](https://github.com/frappe/erpnext/commit/283043eba7d305bd88d64fe5780a1b65ab3725c2)) * add string for translation in delayed_tasks_summary.py ([43fc8bf](https://github.com/frappe/erpnext/commit/43fc8bf74e758ceb8c0a7170fff6fdc3c7ce0b9f)) * add strings for translation in pos_item_cart.js ([71d8dfb](https://github.com/frappe/erpnext/commit/71d8dfb401a8a3f533e5e06eedb27cc9a1ae8d27)) * add strings for translation in timesheet.js ([#44496](https://github.com/frappe/erpnext/issues/44496)) ([106671a](https://github.com/frappe/erpnext/commit/106671a414436fe162d492e7619bcf9ff34236d1)) * add strings for translation payment_terms_status_for_sales_order.py ([773e03f](https://github.com/frappe/erpnext/commit/773e03f84f9514b2d7558be14ea257b9596d4474)) * add title for translation in asset.js ([843ff18](https://github.com/frappe/erpnext/commit/843ff18cf9e45cc88042eb328b30907e888628c8)) * **Bank Transaction:** error in party matching should not block submitting (backport [#44416](https://github.com/frappe/erpnext/issues/44416)) ([#44574](https://github.com/frappe/erpnext/issues/44574)) ([31c2b81](https://github.com/frappe/erpnext/commit/31c2b818bdaf1e7b1dae39a045d8b2fdbd00d4e6)) * BOM for variant items (backport [#44580](https://github.com/frappe/erpnext/issues/44580)) ([#44584](https://github.com/frappe/erpnext/issues/44584)) ([0b26827](https://github.com/frappe/erpnext/commit/0b268279cfbe720917bd73ff952771e1eaae05b4)) * BOM has not attr required items (backport [#44598](https://github.com/frappe/erpnext/issues/44598)) ([#44600](https://github.com/frappe/erpnext/issues/44600)) ([608eaaa](https://github.com/frappe/erpnext/commit/608eaaa482507cd5724e4b05ee0dc99e0b6f5004)) * BOM name issue (backport [#44575](https://github.com/frappe/erpnext/issues/44575)) ([#44579](https://github.com/frappe/erpnext/issues/44579)) ([03ae9e2](https://github.com/frappe/erpnext/commit/03ae9e27be5acca32d3e15f8434a3f6062dc8c30)) * BOM name issue (backport [#44586](https://github.com/frappe/erpnext/issues/44586)) ([#44589](https://github.com/frappe/erpnext/issues/44589)) ([a5cc307](https://github.com/frappe/erpnext/commit/a5cc30741703857556efe0f201a7bb91231eee0b)) * consider zero valuation rate for serial nos (backport [#44532](https://github.com/frappe/erpnext/issues/44532)) ([#44534](https://github.com/frappe/erpnext/issues/44534)) ([3771c6e](https://github.com/frappe/erpnext/commit/3771c6eeae15644e459181128f41ebd04a8d0c19)) * correct color for draft in list view ([cce1cc6](https://github.com/frappe/erpnext/commit/cce1cc66747cdf3f4a8fe210b53298c41417526f)) * currency symbol in SCO and SCR (backport [#44577](https://github.com/frappe/erpnext/issues/44577)) ([#44594](https://github.com/frappe/erpnext/issues/44594)) ([2a17ecd](https://github.com/frappe/erpnext/commit/2a17ecdc3949380215b03e4ae296de40efc2c11d)) * description overwrite on qty change (backport [#44606](https://github.com/frappe/erpnext/issues/44606)) ([#44609](https://github.com/frappe/erpnext/issues/44609)) ([243bf54](https://github.com/frappe/erpnext/commit/243bf542c43de476c8d0c26c34bd45d31e72f905)) * do not allow to inward same serial nos multiple times (backport [#44617](https://github.com/frappe/erpnext/issues/44617)) ([#44619](https://github.com/frappe/erpnext/issues/44619)) ([bdb60a5](https://github.com/frappe/erpnext/commit/bdb60a51c3232dc14b052822463a43b67b16ed8f)) * duplicate required items in the CSV (backport [#44498](https://github.com/frappe/erpnext/issues/44498)) ([#44507](https://github.com/frappe/erpnext/issues/44507)) ([539c5b7](https://github.com/frappe/erpnext/commit/539c5b7974ffdaf4caf8acb6d4acc00fba626668)) * incorrect stock UOM for BOM raw materials (backport [#44528](https://github.com/frappe/erpnext/issues/44528)) ([#44531](https://github.com/frappe/erpnext/issues/44531)) ([f4aa4c9](https://github.com/frappe/erpnext/commit/f4aa4c94668a95a04b5a36dde582474df0f0be7b)) * inv dimensions fields not creating for standard doctype (backport [#44504](https://github.com/frappe/erpnext/issues/44504)) ([#44515](https://github.com/frappe/erpnext/issues/44515)) ([8733eda](https://github.com/frappe/erpnext/commit/8733eda576fe6d27ea64dfb43ee52c2f1215b234)) * make projected qty editable after submit (backport [#44670](https://github.com/frappe/erpnext/issues/44670)) ([#44671](https://github.com/frappe/erpnext/issues/44671)) ([bd9c84d](https://github.com/frappe/erpnext/commit/bd9c84d3b76908b6756d0b3ade35e50722f30332)) * not able to make PO for returned qty from material request (backport [#44540](https://github.com/frappe/erpnext/issues/44540)) ([#44547](https://github.com/frappe/erpnext/issues/44547)) ([5ef063c](https://github.com/frappe/erpnext/commit/5ef063c63471092f568ee5fdead5ae0f2f52a74d)) * not able to make sales return entry (backport [#44605](https://github.com/frappe/erpnext/issues/44605)) ([#44613](https://github.com/frappe/erpnext/issues/44613)) ([04b07a9](https://github.com/frappe/erpnext/commit/04b07a9e1c0235d5a8515973f55c2676532dfcc3)) * precision check for salvage value ([ef5a564](https://github.com/frappe/erpnext/commit/ef5a5643dca2c5ee8f008088eb9bcc77079e72e9)) * prevent set_payment_schedule on return documents ([2560beb](https://github.com/frappe/erpnext/commit/2560beb69581ef74551e892e54410cde0fb13a00)) * required by date in the reorder material request (backport [#44497](https://github.com/frappe/erpnext/issues/44497)) ([#44509](https://github.com/frappe/erpnext/issues/44509)) ([07df87a](https://github.com/frappe/erpnext/commit/07df87ab6972ed3bb23b8ce8029a787a367655cf)) * restrict advance payment entries with flag ([98bd5f2](https://github.com/frappe/erpnext/commit/98bd5f20c4e20edb766ad4b0b4df23fda5552be9)) * strings for translation in pos_past_order_summary.js ([ceec5fd](https://github.com/frappe/erpnext/commit/ceec5fdb6c094928cb566973547ebe571d655f51)) * update free item qty while adding same item in seperate row ([f88dc26](https://github.com/frappe/erpnext/commit/f88dc263d5746f1f3f9b9dafd75d050390df23a1)) * update qty in SABB if qty changed in stock reco (backport [#44542](https://github.com/frappe/erpnext/issues/44542)) ([#44546](https://github.com/frappe/erpnext/issues/44546)) ([99a3271](https://github.com/frappe/erpnext/commit/99a327155e4a13e5ea8e0ad188a1acd38f90efed)) * validate returned serial nos and batches (backport [#44669](https://github.com/frappe/erpnext/issues/44669)) ([#44674](https://github.com/frappe/erpnext/issues/44674)) ([33273fa](https://github.com/frappe/erpnext/commit/33273faccbd514dd635c821a9cb18c30f6513982)) * valuation rate for batch in stock reconciliation (backport [#44657](https://github.com/frappe/erpnext/issues/44657)) ([#44664](https://github.com/frappe/erpnext/issues/44664)) ([2466e4c](https://github.com/frappe/erpnext/commit/2466e4c2fdf887a435a035dad4095b1b3f9b0ba4)) * variant qty while making work order from BOM (backport [#44548](https://github.com/frappe/erpnext/issues/44548)) ([#44551](https://github.com/frappe/erpnext/issues/44551)) ([63b1df3](https://github.com/frappe/erpnext/commit/63b1df38a81877168ea71047c9b29db144c4d8a9)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index bb8bf11b7ea..679554abb55 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.45.4" +__version__ = "15.45.5" def get_default_company(user=None): From 375b48699f12e5a8e70f16394eff51386d38abf1 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 18 Dec 2024 05:32:46 +0000 Subject: [PATCH 02/94] chore(release): Bumped to Version 15.46.0 # [15.46.0](https://github.com/frappe/erpnext/compare/v15.45.5...v15.46.0) (2024-12-18) ### Bug Fixes * add doc.status to translation from POS ([0ba6e60](https://github.com/frappe/erpnext/commit/0ba6e60608b2f00d3ab68b6c837994f17e7df8d0)) * allow all dispatch address for drop ship invoice ([db3a87c](https://github.com/frappe/erpnext/commit/db3a87c837bbccab59e3cc30e132aaa5b72bc66b)) * broken CI ([78d7d71](https://github.com/frappe/erpnext/commit/78d7d7148f2443e48b4feb088c70522f62b6040f)) * delink SABB from cancelled SLEs (backport [#44691](https://github.com/frappe/erpnext/issues/44691)) ([#44719](https://github.com/frappe/erpnext/issues/44719)) ([8940747](https://github.com/frappe/erpnext/commit/8940747161ca368e8ebab8f0eae199a70f09c3cf)) * duplicate Use Multi-Level BOM checkbox ([#44757](https://github.com/frappe/erpnext/issues/44757)) ([3ac801c](https://github.com/frappe/erpnext/commit/3ac801c884f93b1008adc126e31f73d6820575b1)) * handle zero salvage value case ([632a45d](https://github.com/frappe/erpnext/commit/632a45d82e60ba4179d8f6c9a36e511e97de9193)) * make rate of depreciation mandatory ([ed42ed0](https://github.com/frappe/erpnext/commit/ed42ed04d262a492291a4720a8af6a32661f993e)) * pos invoice return reference missing (backport [#44720](https://github.com/frappe/erpnext/issues/44720)) ([#44729](https://github.com/frappe/erpnext/issues/44729)) ([8aec131](https://github.com/frappe/erpnext/commit/8aec13115c28c5e28679f69ad2cb9ceae3d09cd6)) * purchase return entry issue (backport [#44721](https://github.com/frappe/erpnext/issues/44721)) ([#44737](https://github.com/frappe/erpnext/issues/44737)) ([8ba7424](https://github.com/frappe/erpnext/commit/8ba7424996136209c32b60593219e33fa330e8f7)) * remove invalid filter in Account Receivable report ([fdfbb57](https://github.com/frappe/erpnext/commit/fdfbb577794fa6af0d3b148555d4d518632f72b9)) * set company bank account if default account not set in mode of payment ([a8f7393](https://github.com/frappe/erpnext/commit/a8f739370610c21e8643526eb14c8055dbe0563a)) * switched asset terminology from cost to value ([47c7356](https://github.com/frappe/erpnext/commit/47c7356b38447ec70391cb329a972deedbfee0bf)) * unsupported operand type (backport [#44722](https://github.com/frappe/erpnext/issues/44722)) ([#44723](https://github.com/frappe/erpnext/issues/44723)) ([158a480](https://github.com/frappe/erpnext/commit/158a4803ca2d0645387fc1b1b9040352b2328e9f)) * update cc_to multiselect in process statement of accounts ([df9bc33](https://github.com/frappe/erpnext/commit/df9bc33f34c67ee0200be5e29bb99da09dab34ff)) * update discount when pricing rule is changed ([f1a5000](https://github.com/frappe/erpnext/commit/f1a5000872d0a3dc79f271afbe7a4d045282635f)) * User permissions in financial statements ([83aeb2e](https://github.com/frappe/erpnext/commit/83aeb2e4754700467508533a7d4d736dbdfe489a)) * using query.walk() for escaping ([40a8ed8](https://github.com/frappe/erpnext/commit/40a8ed85711f86e95f8d5eca23ca6d3a77c74084)) * Wrong allocated_amount for sales_team in gross_profit report ([#42989](https://github.com/frappe/erpnext/issues/42989)) ([328b9e7](https://github.com/frappe/erpnext/commit/328b9e7d9e59b1f7e188d7ad211158806022372d)) ### Features * change type link to multiselect ([7665eac](https://github.com/frappe/erpnext/commit/7665eac277a1128eb686f97d3038fdd5d27c1063)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 679554abb55..ba7c7f49afb 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.45.5" +__version__ = "15.46.0" def get_default_company(user=None): From 8eb8cc5d3cd6cf530c4b20674d19e1b36a39ce6c Mon Sep 17 00:00:00 2001 From: ljain112 Date: Wed, 18 Dec 2024 13:47:37 +0530 Subject: [PATCH 03/94] fix: 'str' object has no attribute 'get_sql' (cherry picked from commit 9a43acb65c3930cfd552d25e6aa3f3909bb4adf9) --- erpnext/accounts/report/financial_statements.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py index 918bafa169a..c653ae1b38f 100644 --- a/erpnext/accounts/report/financial_statements.py +++ b/erpnext/accounts/report/financial_statements.py @@ -529,13 +529,12 @@ def get_accounting_entries( from frappe.desk.reportview import build_match_conditions + query, params = query.walk() match_conditions = build_match_conditions(doctype) if match_conditions: query += "and" + match_conditions - query, params = query.walk() - return frappe.db.sql(query, params, as_dict=True) From 9aed4289397f33b8c6986aba7b277815fc625930 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 18 Dec 2024 09:10:34 +0000 Subject: [PATCH 04/94] chore(release): Bumped to Version 15.46.1 ## [15.46.1](https://github.com/frappe/erpnext/compare/v15.46.0...v15.46.1) (2024-12-18) ### Bug Fixes * 'str' object has no attribute 'get_sql' ([8eb8cc5](https://github.com/frappe/erpnext/commit/8eb8cc5d3cd6cf530c4b20674d19e1b36a39ce6c)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index ba7c7f49afb..e81409cf049 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.46.0" +__version__ = "15.46.1" def get_default_company(user=None): From a79d2946a16e1cb1d7dd4e507551790c0b5826e3 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Thu, 19 Dec 2024 17:06:54 +0530 Subject: [PATCH 05/94] fix: Ledger repost support for extending app doctypes (cherry picked from commit ed231abb54544f7362812500d9cbaefce09f778d) --- .../repost_accounting_ledger.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/erpnext/accounts/doctype/repost_accounting_ledger/repost_accounting_ledger.py b/erpnext/accounts/doctype/repost_accounting_ledger/repost_accounting_ledger.py index 0bd9a2a0515..7f2d437aece 100644 --- a/erpnext/accounts/doctype/repost_accounting_ledger/repost_accounting_ledger.py +++ b/erpnext/accounts/doctype/repost_accounting_ledger/repost_accounting_ledger.py @@ -1,6 +1,8 @@ # Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt +import inspect + import frappe from frappe import _, qb from frappe.model.document import Document @@ -142,6 +144,8 @@ class RepostAccountingLedger(Document): @frappe.whitelist() def start_repost(account_repost_doc=str) -> None: + from erpnext.accounts.general_ledger import make_reverse_gl_entries + frappe.flags.through_repost_accounting_ledger = True if account_repost_doc: repost_doc = frappe.get_doc("Repost Accounting Ledger", account_repost_doc) @@ -177,6 +181,14 @@ def start_repost(account_repost_doc=str) -> None: if not repost_doc.delete_cancelled_entries: doc.make_gl_entries(1) doc.make_gl_entries() + else: + if hasattr(doc, "make_gl_entries") and callable(doc.make_gl_entries): + if not repost_doc.delete_cancelled_entries: + if "cancel" in inspect.getfullargspec(doc.make_gl_entries): + doc.make_gl_entries(cancel=1) + else: + make_reverse_gl_entries(voucher_type=doc.doctype, voucher_no=doc.name) + doc.make_gl_entries() def get_allowed_types_from_settings(): From 640c13a5f3307888473e86dc840e2962105f2a47 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Sun, 22 Dec 2024 20:34:31 +0530 Subject: [PATCH 06/94] fix: Add hooks for repost allowed doctypes (cherry picked from commit 919abd2c03865ab671c6977f735638b2f43753b0) --- .../repost_accounting_ledger/repost_accounting_ledger.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/repost_accounting_ledger/repost_accounting_ledger.py b/erpnext/accounts/doctype/repost_accounting_ledger/repost_accounting_ledger.py index 7f2d437aece..73977f5d560 100644 --- a/erpnext/accounts/doctype/repost_accounting_ledger/repost_accounting_ledger.py +++ b/erpnext/accounts/doctype/repost_accounting_ledger/repost_accounting_ledger.py @@ -181,7 +181,7 @@ def start_repost(account_repost_doc=str) -> None: if not repost_doc.delete_cancelled_entries: doc.make_gl_entries(1) doc.make_gl_entries() - else: + elif doc.doctype in frappe.get_hooks("repost_allowed_doctypes"): if hasattr(doc, "make_gl_entries") and callable(doc.make_gl_entries): if not repost_doc.delete_cancelled_entries: if "cancel" in inspect.getfullargspec(doc.make_gl_entries): From 1900cebf52204da4ead3cf844720859a7ee3b4ca Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Mon, 23 Dec 2024 06:17:04 +0000 Subject: [PATCH 07/94] chore(release): Bumped to Version 15.46.2 ## [15.46.2](https://github.com/frappe/erpnext/compare/v15.46.1...v15.46.2) (2024-12-23) ### Bug Fixes * Add hooks for repost allowed doctypes ([640c13a](https://github.com/frappe/erpnext/commit/640c13a5f3307888473e86dc840e2962105f2a47)) * Ledger repost support for extending app doctypes ([a79d294](https://github.com/frappe/erpnext/commit/a79d2946a16e1cb1d7dd4e507551790c0b5826e3)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index e81409cf049..f6dd799ba08 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.46.1" +__version__ = "15.46.2" def get_default_company(user=None): From 139a56b8a44de5d7d5355d7b8dadb8f193943d35 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 25 Dec 2024 03:36:34 +0000 Subject: [PATCH 08/94] chore(release): Bumped to Version 15.47.0 # [15.47.0](https://github.com/frappe/erpnext/compare/v15.46.2...v15.47.0) (2024-12-25) ### Bug Fixes * 'str' object has no attribute 'get_sql' ([8b810f5](https://github.com/frappe/erpnext/commit/8b810f5fb8f451ec6f3c29dd2070785750a643d5)) * add `Stock UOM` when adding new item in POS list ([#44780](https://github.com/frappe/erpnext/issues/44780)) ([96cc9e2](https://github.com/frappe/erpnext/commit/96cc9e29a190f9dffe47ee8b6e59e4353263aa89)) * Add hooks for repost allowed doctypes ([b5596d9](https://github.com/frappe/erpnext/commit/b5596d98e3e6f59d6ac0ee8d7266379ad25ca1b5)) * added docs.frappe.io in documentation_url ([#44776](https://github.com/frappe/erpnext/issues/44776)) ([0fd7792](https://github.com/frappe/erpnext/commit/0fd7792f49f97b45d620098e0faa433a3ea904f1)) * asset field precision check ([516a325](https://github.com/frappe/erpnext/commit/516a325a31d48d5833b285e78cd5dd2f7e2f91c9)) * avg. buying amount for product bundle item with serial and batch no in gross profit report ([2edb6f3](https://github.com/frappe/erpnext/commit/2edb6f3224fd064beaf31dbf722f08ddf68c146c)) * better indicator base amount for Tax Witholding in Journal Entry ([218e777](https://github.com/frappe/erpnext/commit/218e7774238908cc7f26c38243a5322bfe585bee)) * buying rate for service item in gross profit report ([a55aaea](https://github.com/frappe/erpnext/commit/a55aaea5a15f9966635b4960547c62589ef32af2)) * closing stock balance permissions (backport [#44791](https://github.com/frappe/erpnext/issues/44791)) ([#44793](https://github.com/frappe/erpnext/issues/44793)) ([cdeec8d](https://github.com/frappe/erpnext/commit/cdeec8d24c29cb4de3159234a6e627d2f9e7593a)) * correct args for get_advance_payment_entries_for_regional ([875797e](https://github.com/frappe/erpnext/commit/875797e655db4a67696ed6eae963705be5ebaa68)) * correct tds rate with lower deduction certificate ([5ca60f3](https://github.com/frappe/erpnext/commit/5ca60f3e0a353fe18e1db9275bc683852842d6f3)) * do not set cost_center update_voucher_balance as it is set in init_voucher_balance ([19a8ea2](https://github.com/frappe/erpnext/commit/19a8ea217ef9252c2ed78fb6f55a501f525276e7)) * do not validate qc for scrap item (backport [#44844](https://github.com/frappe/erpnext/issues/44844)) ([#44853](https://github.com/frappe/erpnext/issues/44853)) ([8092d58](https://github.com/frappe/erpnext/commit/8092d58d9c36d263a2218fa7b4e95636706faf77)) * Duplicate entry ' EF1DE8B2E1B6' for key 'PRIMARY' (backport [#44809](https://github.com/frappe/erpnext/issues/44809)) ([#44814](https://github.com/frappe/erpnext/issues/44814)) ([16b013f](https://github.com/frappe/erpnext/commit/16b013fab27a84c3889027db255166b76688efc4)) * fetch tax withholding category from the voucher ([8f8dd1c](https://github.com/frappe/erpnext/commit/8f8dd1c088823dd55013da7c79caf58afd73dc11)) * incoming rate should be zero for rejected items (backport [#44857](https://github.com/frappe/erpnext/issues/44857)) ([#44859](https://github.com/frappe/erpnext/issues/44859)) ([0969877](https://github.com/frappe/erpnext/commit/0969877cd7c30d997f5f42de1d8a7197846d07de)) * incorrect Material Transferred for Manufacturing qty (backport [#44823](https://github.com/frappe/erpnext/issues/44823)) ([#44832](https://github.com/frappe/erpnext/issues/44832)) ([497029f](https://github.com/frappe/erpnext/commit/497029f958c0c7167422c32edbd50c080eeaff33)) * Ledger repost support for extending app doctypes ([d137f78](https://github.com/frappe/erpnext/commit/d137f780bd072f0baf18feef734157c90318674b)) * Paid + Write Off Amount issue in Sales Invoice (backport [#44763](https://github.com/frappe/erpnext/issues/44763)) ([#44874](https://github.com/frappe/erpnext/issues/44874)) ([ca7c229](https://github.com/frappe/erpnext/commit/ca7c229e863aefc8fcf9181513afa309b2c3fd25)) * permissions for marking Quotation as lost ([e6390bf](https://github.com/frappe/erpnext/commit/e6390bfba1dca8c961029564c40b5ae1ae37878e)) * POS Closing entry issue (backport [#44772](https://github.com/frappe/erpnext/issues/44772)) ([#44781](https://github.com/frappe/erpnext/issues/44781)) ([2032422](https://github.com/frappe/erpnext/commit/20324224d37e1554fcb958ee79b94e5257ac93c5)) * posting_time issue ([#44870](https://github.com/frappe/erpnext/issues/44870)) ([7a5c30f](https://github.com/frappe/erpnext/commit/7a5c30fe9b5e3833ffeba46cead6ba42a69c0add)) * Remove typo ([13a3c81](https://github.com/frappe/erpnext/commit/13a3c816d742fe2b95cfa889b38d45ee88ea0acf)) * set project in GL from the SLE (backport [#44879](https://github.com/frappe/erpnext/issues/44879)) ([#44885](https://github.com/frappe/erpnext/issues/44885)) ([57e6ed4](https://github.com/frappe/erpnext/commit/57e6ed464594eb096c3a5956874b4773fc3abe97)) * show profit and loss after period closing ([771632a](https://github.com/frappe/erpnext/commit/771632a5e2be9ac2981d951481267ea2244094dd)) * slow posting datetime update (backport [#44799](https://github.com/frappe/erpnext/issues/44799)) ([#44805](https://github.com/frappe/erpnext/issues/44805)) ([ad57e33](https://github.com/frappe/erpnext/commit/ad57e33cd7247c6b822469582e15939dd7a3e80b)) * stock entry not fetching expired batches (backport [#44863](https://github.com/frappe/erpnext/issues/44863)) ([#44868](https://github.com/frappe/erpnext/issues/44868)) ([d6001e5](https://github.com/frappe/erpnext/commit/d6001e5ef9b9fd05b3e534c25cc36f388f8e57ee)) * Stock Entry uses incorrect company when generated from Pick List ([#44679](https://github.com/frappe/erpnext/issues/44679)) ([58e8467](https://github.com/frappe/erpnext/commit/58e846709ec961d965c9b6bdaf5cec482b608305)) * Swedish tax templates ([cc1834b](https://github.com/frappe/erpnext/commit/cc1834b0ccb1c2f5ab1202d4d01aca58dfe56f01)) * test case correction ([ddfead2](https://github.com/frappe/erpnext/commit/ddfead2cde3a25c95bb1bff79680a41365ebf8de)) * typerror on TDS payable monthly report (backport [#37707](https://github.com/frappe/erpnext/issues/37707)) ([db9a319](https://github.com/frappe/erpnext/commit/db9a319104f2b1988a99e6f45bf555e1dcd79ca1)) * update correct cost center in Accounts Receivable Report ([4c5540a](https://github.com/frappe/erpnext/commit/4c5540aef9232d044b9a0bd3de278a3b04222230)) * update query ([3ab4acf](https://github.com/frappe/erpnext/commit/3ab4acfafaa79295b6c56d9c6a03ccfe78f2e9c0)) * use utility method to generate url ([75aee42](https://github.com/frappe/erpnext/commit/75aee42635f87c6a608b43ca7c11d56071965f07)) * **ux:** purchase invoice link in error message ([#44797](https://github.com/frappe/erpnext/issues/44797)) ([01c1ed9](https://github.com/frappe/erpnext/commit/01c1ed98ac3883620ed1c9ebc21eaaf6fd8e8f76)) * Warehouse wise Stock Value chart roles (backport [#44865](https://github.com/frappe/erpnext/issues/44865)) ([#44867](https://github.com/frappe/erpnext/issues/44867)) ([f32cf84](https://github.com/frappe/erpnext/commit/f32cf84413dc4466ad77a320667e296c1344b160)) ### Features * add difference_posting_date field ([bec1f97](https://github.com/frappe/erpnext/commit/bec1f972b36c33b76317fd286370834f71504797)) * **subcontracting:** Added provision to create multiple Subcontracting Orders against a single Purchase Order (backport [#44711](https://github.com/frappe/erpnext/issues/44711)) ([#44782](https://github.com/frappe/erpnext/issues/44782)) ([8f81172](https://github.com/frappe/erpnext/commit/8f811728d97293744bb35f6a3bdba889708127c5)) * swedish COA ([98cc79d](https://github.com/frappe/erpnext/commit/98cc79d9420b63773a1bf04db702d31a162a968c)) * use difference_posting_date for journal entry posting_date ([7498cdf](https://github.com/frappe/erpnext/commit/7498cdf644960525f09b07cc829a09f704a22b4b)) ### Performance Improvements * SABB (backport [#44764](https://github.com/frappe/erpnext/issues/44764)) ([#44789](https://github.com/frappe/erpnext/issues/44789)) ([b706a82](https://github.com/frappe/erpnext/commit/b706a8274f489f1d0b9ef160d771ecd38abadaf8)) * slow query related to stock ledger entry (backport [#44861](https://github.com/frappe/erpnext/issues/44861)) ([#44862](https://github.com/frappe/erpnext/issues/44862)) ([3f3df7e](https://github.com/frappe/erpnext/commit/3f3df7ef2a09d2ce9348b85448bc934eb5b49acf)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index f6dd799ba08..4458398bfff 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.46.2" +__version__ = "15.47.0" def get_default_company(user=None): From 763951af277cd56427cc9569b516a42494ffa941 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 26 Dec 2024 11:30:55 +0530 Subject: [PATCH 09/94] fix: allow zero valuation rate (backport #44902) (backport #44910) (#44913) fix: allow zero valuation rate (backport #44902) (#44910) fix: allow zero valuation rate (#44902) (cherry picked from commit 614a8f106d0cc84f04cd44261d0e2d16a0cca536) Co-authored-by: rohitwaghchaure (cherry picked from commit 9060e4ce57499b5aed335e3fc4b27cd27f452cef) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- erpnext/stock/stock_ledger.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py index d11c19446bb..5aaf30c9889 100644 --- a/erpnext/stock/stock_ledger.py +++ b/erpnext/stock/stock_ledger.py @@ -937,7 +937,7 @@ class update_entries_after: # else it remains the same as that of previous entry self.wh_data.valuation_rate = new_stock_value / new_stock_qty - if not self.wh_data.valuation_rate and sle.voucher_detail_no: + if self.wh_data.valuation_rate is None and sle.voucher_detail_no: allow_zero_rate = self.check_if_allow_zero_valuation_rate(sle.voucher_type, sle.voucher_detail_no) if not allow_zero_rate: self.wh_data.valuation_rate = self.get_fallback_rate(sle) From f25d65ecc40cfdedab4c6f7428dc7ae92d86944d Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Thu, 26 Dec 2024 06:02:20 +0000 Subject: [PATCH 10/94] chore(release): Bumped to Version 15.47.1 ## [15.47.1](https://github.com/frappe/erpnext/compare/v15.47.0...v15.47.1) (2024-12-26) ### Bug Fixes * allow zero valuation rate (backport [#44902](https://github.com/frappe/erpnext/issues/44902)) (backport [#44910](https://github.com/frappe/erpnext/issues/44910)) ([#44913](https://github.com/frappe/erpnext/issues/44913)) ([763951a](https://github.com/frappe/erpnext/commit/763951af277cd56427cc9569b516a42494ffa941)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 4458398bfff..5b93888b84e 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.47.0" +__version__ = "15.47.1" def get_default_company(user=None): From 3a5959e0237fa51afc5242dcc5818710ac9ae43f Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 1 Jan 2025 08:37:05 +0000 Subject: [PATCH 11/94] chore(release): Bumped to Version 15.47.2 ## [15.47.2](https://github.com/frappe/erpnext/compare/v15.47.1...v15.47.2) (2025-01-01) ### Bug Fixes * add company filter to project ([d550b43](https://github.com/frappe/erpnext/commit/d550b433c1e3f32c0c8efee0be026b174511c8f6)) * allow zero valuation rate (backport [#44902](https://github.com/frappe/erpnext/issues/44902)) ([#44910](https://github.com/frappe/erpnext/issues/44910)) ([9060e4c](https://github.com/frappe/erpnext/commit/9060e4ce57499b5aed335e3fc4b27cd27f452cef)) * apply apply_pricing_rule date change ([f09acc7](https://github.com/frappe/erpnext/commit/f09acc784f76c82151eca18e7d40437baf262368)) * apply discount on qty change ([c19725c](https://github.com/frappe/erpnext/commit/c19725ca74c5a891c08f4f4861794cb2ebea8aa0)) * clear payment schedule in purchase invoice for is_paid ([6cc7060](https://github.com/frappe/erpnext/commit/6cc70605fa4d4b61b329a323aec49b6005ad7af4)) * copy accounting dimensions to asset and sales invoice ([#44964](https://github.com/frappe/erpnext/issues/44964)) ([839ffb3](https://github.com/frappe/erpnext/commit/839ffb3f2a88e6e3c9901a943c52ce5e7ce03669)) * duplicate validate for closing stock balance ([#45015](https://github.com/frappe/erpnext/issues/45015)) ([8d650e5](https://github.com/frappe/erpnext/commit/8d650e56ba9777c2f0df324a15215cac51641719)) * failing tests fixed ([61367ee](https://github.com/frappe/erpnext/commit/61367ee1edb5ebff648750fd1f2886c58acf4198)) * fetch advance payment entries on pos invoice (backport [#44856](https://github.com/frappe/erpnext/issues/44856)) ([#44931](https://github.com/frappe/erpnext/issues/44931)) ([cc827c8](https://github.com/frappe/erpnext/commit/cc827c8077bd0f358ee23c01e92c2ef168c4b4d8)) * fetch amount in company currency ([b135a68](https://github.com/frappe/erpnext/commit/b135a684a5a86b6dcfc0896705f482cebace55df)) * get item tax template based on posting date ([2feeebb](https://github.com/frappe/erpnext/commit/2feeebb5fbe7972b8b638d65b54f441e5cc16b27)) * ignore duplicate while creating default templates ([6c206c1](https://github.com/frappe/erpnext/commit/6c206c1cb324133195913b5b00cf1a88858dd162)) * ignore inventory dimension for SABB and Pick List (backport [#44933](https://github.com/frappe/erpnext/issues/44933)) ([#44941](https://github.com/frappe/erpnext/issues/44941)) ([772b7b9](https://github.com/frappe/erpnext/commit/772b7b95ac5e7445020414cd2775fb729a75775d)) * ignore validate while making WO from MR (backport [#44939](https://github.com/frappe/erpnext/issues/44939)) ([#44942](https://github.com/frappe/erpnext/issues/44942)) ([c33e075](https://github.com/frappe/erpnext/commit/c33e07550cbfdbd5adc113cec35109950500a599)) * in_contex_translation_fixes ([1353a14](https://github.com/frappe/erpnext/commit/1353a14a6b4c58b96916b3bf4f7a27e85716ab79)) * include company in filter condition ([7422043](https://github.com/frappe/erpnext/commit/74220430e537c40ca6b0af1dffe0412f23ef8c99)) * incorrect filter for BOM (backport [#44954](https://github.com/frappe/erpnext/issues/44954)) ([#44956](https://github.com/frappe/erpnext/issues/44956)) ([9853bd9](https://github.com/frappe/erpnext/commit/9853bd9ba128d448999690221cc854ec19da8f29)) * incorrect quality inspection linked in purchase receipt (backport [#44985](https://github.com/frappe/erpnext/issues/44985)) ([#45020](https://github.com/frappe/erpnext/issues/45020)) ([0a2cc6b](https://github.com/frappe/erpnext/commit/0a2cc6bcd73ab0c98040cb8b4d247a8176bf9aaf)) * limit discount value to 100 in pos cart (backport [#44916](https://github.com/frappe/erpnext/issues/44916)) ([#44932](https://github.com/frappe/erpnext/issues/44932)) ([28442f3](https://github.com/frappe/erpnext/commit/28442f34148adcc2cf0b9a301c490a071ec791e5)) * load customer default price list in pos during item selection (backport [#44991](https://github.com/frappe/erpnext/issues/44991)) ([#44993](https://github.com/frappe/erpnext/issues/44993)) ([20efe7b](https://github.com/frappe/erpnext/commit/20efe7bb801be48f5d0df75050d76a715375c8c7)) * material request status (backport [#44917](https://github.com/frappe/erpnext/issues/44917)) ([#44918](https://github.com/frappe/erpnext/issues/44918)) ([042d12b](https://github.com/frappe/erpnext/commit/042d12b2c14ab689d8676803bc6136f897f57932)) * move code from purchase invoice to buying controller ([98631eb](https://github.com/frappe/erpnext/commit/98631eb266889a309961747ee3a2c583aa7c8a63)) * negative stock balance (backport [#44990](https://github.com/frappe/erpnext/issues/44990)) ([#44996](https://github.com/frappe/erpnext/issues/44996)) ([6f71389](https://github.com/frappe/erpnext/commit/6f7138996a0252f919e0ff47f5b19a1dab1ff9d6)) * not able to make purchase receipt from SCR (backport [#44919](https://github.com/frappe/erpnext/issues/44919)) ([#44925](https://github.com/frappe/erpnext/issues/44925)) ([c241262](https://github.com/frappe/erpnext/commit/c24126226660889427bb169d5460e04fa5be7a45)) * pos payment using non-default mode of payment (backport [#44920](https://github.com/frappe/erpnext/issues/44920)) ([#44971](https://github.com/frappe/erpnext/issues/44971)) ([7dd2b0c](https://github.com/frappe/erpnext/commit/7dd2b0c189f2fd0d0c3ab62dc4554dc53521df73)), closes [#41108](https://github.com/frappe/erpnext/issues/41108) * precision issue (backport [#45013](https://github.com/frappe/erpnext/issues/45013)) ([#45019](https://github.com/frappe/erpnext/issues/45019)) ([52bdf5b](https://github.com/frappe/erpnext/commit/52bdf5b17041edda8a021f04f9d8a03f8c011bf3)) * refactor query in get_total_allocated_amount in bank_transaction ([944dc96](https://github.com/frappe/erpnext/commit/944dc966bc2c26bf11986d52d5186f4e89fd11cc)) * relabel rate to tax rate ([991a336](https://github.com/frappe/erpnext/commit/991a3366a8e19cd9ba4f52fe4e911167842b4786)) * remove unused variable ([b892282](https://github.com/frappe/erpnext/commit/b8922823a3e3989827f3009ad17621dbda704543)) * **report:** Purchase Order Analysis pymysql.err (backport [#44957](https://github.com/frappe/erpnext/issues/44957)) ([#44994](https://github.com/frappe/erpnext/issues/44994)) ([ea4b6e8](https://github.com/frappe/erpnext/commit/ea4b6e8dd726e2c8a8a94f7e70bd5cab03ea6876)) * resolved conflicts ([00ae829](https://github.com/frappe/erpnext/commit/00ae829d890011df66cf66460e8119d649571c0e)) * set paid amount in party currency in bank reco payment entry ([6703a45](https://github.com/frappe/erpnext/commit/6703a457fe51024f557c898668eefedc2d3b60f7)) * set/update billing address on change of company ([cfa432d](https://github.com/frappe/erpnext/commit/cfa432dbcae7c5bfec6ec8be83229211de9c639c)) * Show order tax amount in customer currency on the portal (backport [#44915](https://github.com/frappe/erpnext/issues/44915)) ([#44923](https://github.com/frappe/erpnext/issues/44923)) ([5cc9e10](https://github.com/frappe/erpnext/commit/5cc9e10923a1687bf5ee41e7036acd88de397f26)) * SQL syntax error in Purchase Receipt query for empty filters ([#44636](https://github.com/frappe/erpnext/issues/44636)) ([2f279a6](https://github.com/frappe/erpnext/commit/2f279a6eb417af7d43608fc699fe64ae1c9aaae3)) * strings for translation (backport [#44816](https://github.com/frappe/erpnext/issues/44816)) ([#44927](https://github.com/frappe/erpnext/issues/44927)) ([488d808](https://github.com/frappe/erpnext/commit/488d8080c8cd416adcc3249c5f88e505436c805d)) * update item_tax_rate in backend ([8885b07](https://github.com/frappe/erpnext/commit/8885b071143a64912cd00f2632fe4de0ccd8f8d1)) * use meta to check field instead of doctype ([e582ff8](https://github.com/frappe/erpnext/commit/e582ff862e09fdcf024f1df64fbd48945a90002f)) * Validate party on non receivable / payable account (backport [#44883](https://github.com/frappe/erpnext/issues/44883)) ([#44973](https://github.com/frappe/erpnext/issues/44973)) ([d6903fb](https://github.com/frappe/erpnext/commit/d6903fbc8d7f011062d56504d5c20b7d2ebfa859)) * whitespace ([2efc701](https://github.com/frappe/erpnext/commit/2efc701e4e37127aff69035742b0f415ae4b3505)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 5b93888b84e..1b3d96320dc 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.47.1" +__version__ = "15.47.2" def get_default_company(user=None): From bb75adb59c690d0e0831aa546d2e7d589894beb3 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 1 Jan 2025 15:11:01 +0530 Subject: [PATCH 12/94] fix: slow stock transactions (backport #45025) (#45027) fix: slow stock transactions (#45025) (cherry picked from commit e92af10f146491b6e559a61db66dca29311ae7c4) Co-authored-by: rohitwaghchaure (cherry picked from commit 85ba96e0f3377b48da6ac9085de7a7becf70a814) --- erpnext/stock/stock_balance.py | 2 +- erpnext/stock/stock_ledger.py | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/erpnext/stock/stock_balance.py b/erpnext/stock/stock_balance.py index 23c21ed096e..6a2f818f7ae 100644 --- a/erpnext/stock/stock_balance.py +++ b/erpnext/stock/stock_balance.py @@ -80,7 +80,7 @@ def get_balance_qty_from_sle(item_code, warehouse): balance_qty = frappe.db.sql( """select qty_after_transaction from `tabStock Ledger Entry` where item_code=%s and warehouse=%s and is_cancelled=0 - order by posting_date desc, posting_time desc, creation desc + order by posting_datetime desc, creation desc limit 1""", (item_code, warehouse), ) diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py index 5aaf30c9889..1b299b52dd6 100644 --- a/erpnext/stock/stock_ledger.py +++ b/erpnext/stock/stock_ledger.py @@ -1570,7 +1570,7 @@ def get_previous_sle_of_current_voucher(args, operator="<", exclude_current_vouc and ( posting_datetime {operator} %(posting_datetime)s ) - order by posting_date desc, posting_time desc, creation desc + order by posting_datetime desc, creation desc limit 1 for update""", { @@ -1664,7 +1664,7 @@ def get_stock_ledger_entries( where item_code = %(item_code)s and is_cancelled = 0 {conditions} - order by posting_date {order}, posting_time {order}, creation {order} + order by posting_datetime {order}, creation {order} {limit} {for_update}""".format( conditions=conditions, limit=limit or "", @@ -1786,7 +1786,7 @@ def get_valuation_rate( AND valuation_rate >= 0 AND is_cancelled = 0 AND NOT (voucher_no = %s AND voucher_type = %s) - order by posting_date desc, posting_time desc, name desc limit 1""", + order by posting_datetime desc, creation desc limit 1""", (item_code, warehouse, voucher_no, voucher_type), ): return flt(last_valuation_rate[0][0]) @@ -2037,7 +2037,7 @@ def get_future_sle_with_negative_qty(sle_args): and posting_datetime >= %(posting_datetime)s and is_cancelled = 0 and qty_after_transaction < 0 - order by posting_date asc, posting_time asc + order by posting_datetime asc, creation asc limit 1 """, sle_args, @@ -2051,14 +2051,14 @@ def get_future_sle_with_negative_batch_qty(sle_args): with batch_ledger as ( select posting_date, posting_time, posting_datetime, voucher_type, voucher_no, - sum(actual_qty) over (order by posting_date, posting_time, creation) as cumulative_total + sum(actual_qty) over (order by posting_datetime, creation) as cumulative_total from `tabStock Ledger Entry` where item_code = %(item_code)s and warehouse = %(warehouse)s and batch_no=%(batch_no)s and is_cancelled = 0 - order by posting_date, posting_time, creation + order by posting_datetime, creation ) select * from batch_ledger where From 005df08656b99c891f511e1a0ea122d0b4895016 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 1 Jan 2025 10:00:40 +0000 Subject: [PATCH 13/94] chore(release): Bumped to Version 15.47.3 ## [15.47.3](https://github.com/frappe/erpnext/compare/v15.47.2...v15.47.3) (2025-01-01) ### Bug Fixes * slow stock transactions (backport [#45025](https://github.com/frappe/erpnext/issues/45025)) ([#45027](https://github.com/frappe/erpnext/issues/45027)) ([bb75adb](https://github.com/frappe/erpnext/commit/bb75adb59c690d0e0831aa546d2e7d589894beb3)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 1b3d96320dc..0c79c64e174 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.47.2" +__version__ = "15.47.3" def get_default_company(user=None): From a5a219cd6ec01abcd546e206c7be19c9b7d63a58 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 2 Jan 2025 20:50:28 +0530 Subject: [PATCH 14/94] chore: partial revert #44989 (cherry picked from commit 63d547fb4af311cdb061a029a4e6ca0ae41bbaed) --- erpnext/public/js/controllers/transaction.js | 1 - 1 file changed, 1 deletion(-) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index db866bd3b76..f6d124de23d 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -813,7 +813,6 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe } validate() { - this.apply_pricing_rule() this.calculate_taxes_and_totals(false); } From c3d1e122be58203d4294fa62b419c6811355c504 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Fri, 3 Jan 2025 01:24:44 +0000 Subject: [PATCH 15/94] chore(release): Bumped to Version 15.47.4 ## [15.47.4](https://github.com/frappe/erpnext/compare/v15.47.3...v15.47.4) (2025-01-03) ### Bug Fixes * Added patch and fallback code to prevent future issues similiar to helpdesk ticket 28246 ([ab87265](https://github.com/frappe/erpnext/commit/ab87265395c99b12ef0a2fd764930fa909ce8ab7)) * Added patch and fallback code to prevent future issues similiar to helpdesk ticket 28246 ([66544bf](https://github.com/frappe/erpnext/commit/66544bfa109bd65763cc682211fed2ae00affec3)) * BOM cost update issue ([00102a1](https://github.com/frappe/erpnext/commit/00102a15e3870888bcf74a5215141e77d1aaf8b0)) * Fixed logic in if condition causing tests to fail ([b3b8083](https://github.com/frappe/erpnext/commit/b3b808335f34ee73df494d8ef015001388d0bca1)) * Removed patch as instructed by mentor ([3049027](https://github.com/frappe/erpnext/commit/3049027f437ade49db2fa0cf9fcc1c67c11fb750)) * Removed patch as instructed by mentor ([163af91](https://github.com/frappe/erpnext/commit/163af91c377bfd2398b892e7e3abd9033e401f49)) * removed unknown patch? ([f9d038e](https://github.com/frappe/erpnext/commit/f9d038ee4a255dc1e1e34b178d119b7e79936b62)) * removed unused code ([d31b0a5](https://github.com/frappe/erpnext/commit/d31b0a507f6b6793890f3984be3d03207e3e67c6)) * slow stock transactions (backport [#45025](https://github.com/frappe/erpnext/issues/45025)) ([#45027](https://github.com/frappe/erpnext/issues/45027)) ([85ba96e](https://github.com/frappe/erpnext/commit/85ba96e0f3377b48da6ac9085de7a7becf70a814)) * **style:** set image width in BOM ([6247d5a](https://github.com/frappe/erpnext/commit/6247d5aadb73c216f36646919b6883f7a582fa87)) * validate components and their qty as per BOM in the stock entry ([b5f6926](https://github.com/frappe/erpnext/commit/b5f6926140711407d83516b7aa1081e59f640fac)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 0c79c64e174..b66aaef899b 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.47.3" +__version__ = "15.47.4" def get_default_company(user=None): From 807694206b96ec937b2d2e8e96f809e2e17b59c8 Mon Sep 17 00:00:00 2001 From: venkat102 Date: Thu, 2 Jan 2025 16:10:12 +0530 Subject: [PATCH 16/94] fix: ignore currency validation while canceling the voucher (cherry picked from commit 15d488b9aa97cf91aa7ac97b1870e4f5cd49acc8) --- erpnext/accounts/doctype/gl_entry/gl_entry.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/erpnext/accounts/doctype/gl_entry/gl_entry.py b/erpnext/accounts/doctype/gl_entry/gl_entry.py index d9d7807a561..c77a201ab51 100644 --- a/erpnext/accounts/doctype/gl_entry/gl_entry.py +++ b/erpnext/accounts/doctype/gl_entry/gl_entry.py @@ -275,6 +275,9 @@ class GLEntry(Document): validate_account_party_type(self) def validate_currency(self): + if self.is_cancelled: + return + company_currency = erpnext.get_company_currency(self.company) account_currency = get_account_currency(self.account) From bc0be5a00a321c657e86a96d33afa36f5f12d193 Mon Sep 17 00:00:00 2001 From: venkat102 Date: Thu, 2 Jan 2025 17:27:34 +0530 Subject: [PATCH 17/94] fix: ignore party account validation while canceling the voucher (cherry picked from commit 49885f8eae8c95e1b319c4e48ca64005ffa5b93d) --- erpnext/accounts/party.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py index 3033b8ad087..396c814dff6 100644 --- a/erpnext/accounts/party.py +++ b/erpnext/accounts/party.py @@ -760,6 +760,9 @@ def validate_party_frozen_disabled(party_type, party_name): def validate_account_party_type(self): + if self.is_cancelled: + return + if self.party_type and self.party: account_type = frappe.get_cached_value("Account", self.account, "account_type") if account_type and (account_type not in ["Receivable", "Payable"]): From 08e58e13acf68f49b32e43ec05c4b2d7c4c1ba4f Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Mon, 6 Jan 2025 04:42:56 +0000 Subject: [PATCH 18/94] chore(release): Bumped to Version 15.47.5 ## [15.47.5](https://github.com/frappe/erpnext/compare/v15.47.4...v15.47.5) (2025-01-06) ### Bug Fixes * ignore currency validation while canceling the voucher ([8076942](https://github.com/frappe/erpnext/commit/807694206b96ec937b2d2e8e96f809e2e17b59c8)) * ignore party account validation while canceling the voucher ([bc0be5a](https://github.com/frappe/erpnext/commit/bc0be5a00a321c657e86a96d33afa36f5f12d193)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index b66aaef899b..d4763ea5a56 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.47.4" +__version__ = "15.47.5" def get_default_company(user=None): From 6a869139a6470b706adfbaa89f029ae7d2e2bd23 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 8 Jan 2025 10:29:45 +0000 Subject: [PATCH 19/94] chore(release): Bumped to Version 15.48.0 # [15.48.0](https://github.com/frappe/erpnext/compare/v15.47.5...v15.48.0) (2025-01-08) ### Bug Fixes * add monthly distributation and write query in qb ([03b06fc](https://github.com/frappe/erpnext/commit/03b06fc3ff1ab13956f53841c0f7b601a3703a57)) * Alternative Item button dissapearing on Save event ([642b897](https://github.com/frappe/erpnext/commit/642b89782d5d1a2d53c12ed192e2e3dd62e65365)) * Alternative Items button in Work Order ([3194807](https://github.com/frappe/erpnext/commit/3194807a41212c18d2b1578ad91143c54ba5b415)) * Bank Reconciliation Statement Report Company Filter ([622bfa6](https://github.com/frappe/erpnext/commit/622bfa6633cf9b9ac7423811d04e42249b96d30a)) * consider expired batches in stock reco ([c924feb](https://github.com/frappe/erpnext/commit/c924feb0d0ad206423fc959b83ce4aa948ece592)) * discount resetting on date change ([af53381](https://github.com/frappe/erpnext/commit/af5338116338ac9eb88e9c440528cff248aa03d4)), closes [#44989](https://github.com/frappe/erpnext/issues/44989) * Hold_to_On_Hold ([9ecafdc](https://github.com/frappe/erpnext/commit/9ecafdc6807846be6d739cfedbe9401765d1b5a4)) * ignore currency validation while canceling the voucher ([8874f4a](https://github.com/frappe/erpnext/commit/8874f4a9e44ea249a11c9c2b7ca55c06a7602ef1)) * ignore party account validation while canceling the voucher ([0f1c6ff](https://github.com/frappe/erpnext/commit/0f1c6ff1c9ca7e6a573b94ccc21789b3616951bb)) * invoice against purchase receipt with returned quantity ([9daabfc](https://github.com/frappe/erpnext/commit/9daabfca8a3dc4d940d02bf218cfd02605dbde0f)) * issue in returning components against the SCO ([87405f0](https://github.com/frappe/erpnext/commit/87405f0753d78655d621f3324003ac2b3ee743ca)) * load price list rate for pos search term ([452dffa](https://github.com/frappe/erpnext/commit/452dffab48cedcf44949caaf2036084196b6522e)) * load search term price with customer default price list ([59af144](https://github.com/frappe/erpnext/commit/59af144e298dbdb0ae5dbd4281bc0b2a1e9f615b)) * Missing company filter breaks `get_account_balance` in Bank Reco ([931b516](https://github.com/frappe/erpnext/commit/931b5166a86d235e709734f79065d6cab57c8547)) * Override pre-commit behaviour due to conflicts with CI ([754845a](https://github.com/frappe/erpnext/commit/754845a935d735a5e074b7de42f1df40cf8cf2e7)) * **Project:** make status in confirmation dialog translatable ([#45118](https://github.com/frappe/erpnext/issues/45118)) ([0001d86](https://github.com/frappe/erpnext/commit/0001d868c7f3bf79b296111291608e20340bb261)) * removed unmerged patches ([4227d76](https://github.com/frappe/erpnext/commit/4227d76f082496b79ef2ae4ebf2bab2502f63e5e)) * resolved conflicts ([e9be858](https://github.com/frappe/erpnext/commit/e9be8583b0f374e5c2b5b655377c4397bb130288)) * resolved conflicts ([7318748](https://github.com/frappe/erpnext/commit/7318748a4ccc51c69fb6f86ef49c9cc8d9df1d83)) * Returned Qty in Work Order Consumed Materials report ([f7b501b](https://github.com/frappe/erpnext/commit/f7b501b29bcaa39e486638cf442c385d7e7e39f1)) * serial and batch no. buttons on pos ([#45048](https://github.com/frappe/erpnext/issues/45048)) ([54e3a74](https://github.com/frappe/erpnext/commit/54e3a749365c6979fb83b2cb962fd4db8f04cd60)) * show new button in coa if create access ([89155f5](https://github.com/frappe/erpnext/commit/89155f529e757296ad4ff97dee6fe54b3a090cb4)) * update customer contact details on pos (backport [#45071](https://github.com/frappe/erpnext/issues/45071)) ([#45106](https://github.com/frappe/erpnext/issues/45106)) ([01254da](https://github.com/frappe/erpnext/commit/01254da4e06b6e0114ecfc56e89aacdf5bab027b)) ### Features * validate discount date in payment schedule (backport [#44646](https://github.com/frappe/erpnext/issues/44646)) ([#44727](https://github.com/frappe/erpnext/issues/44727)) ([500deff](https://github.com/frappe/erpnext/commit/500deff3e9e695d6cc80320d8bce4fad0739a91d)) * work in progress status for asset ([#45066](https://github.com/frappe/erpnext/issues/45066)) ([1ea36bb](https://github.com/frappe/erpnext/commit/1ea36bba886ecae907aa0a09e5a6e86e77899cb9)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index d4763ea5a56..7354e28f238 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.47.5" +__version__ = "15.48.0" def get_default_company(user=None): From 5d7a3b59799f1871ac978438c7cac3003fcbd6a1 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Thu, 9 Jan 2025 14:31:01 +0530 Subject: [PATCH 20/94] fix: not able to see create Quality Inspection button (cherry picked from commit b291835ccda4b7696ba5aee05628f2c647be667f) (cherry picked from commit a79cae1fefb31e85b59bc2993ef5497d1e2bab31) --- erpnext/public/js/controllers/transaction.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 9e3a76b12ca..79ed7d0a836 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -302,8 +302,13 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe return; } + let show_qc_button = true; + if (["Sales Invoice", "Purchase Invoice"].includes(this.frm.doc.doctype)) { + show_qc_button = this.frm.doc.update_stock; + } + const me = this; - if (!this.frm.is_new() && this.frm.doc.docstatus === 0 && frappe.model.can_create("Quality Inspection") && this.frm.doc.update_stock) { + if (!this.frm.is_new() && this.frm.doc.docstatus === 0 && frappe.model.can_create("Quality Inspection") && show_qc_button) { this.frm.add_custom_button(__("Quality Inspection(s)"), () => { me.make_quality_inspection(); }, __("Create")); From 246f4373b55d4ae47b891238acf63a42a36c6735 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Thu, 9 Jan 2025 09:31:15 +0000 Subject: [PATCH 21/94] chore(release): Bumped to Version 15.48.1 ## [15.48.1](https://github.com/frappe/erpnext/compare/v15.48.0...v15.48.1) (2025-01-09) ### Bug Fixes * not able to see create Quality Inspection button ([5d7a3b5](https://github.com/frappe/erpnext/commit/5d7a3b59799f1871ac978438c7cac3003fcbd6a1)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 7354e28f238..67248b1c1d6 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.48.0" +__version__ = "15.48.1" def get_default_company(user=None): From ac18c56a0bd13823d6aadae3b9461045647fb510 Mon Sep 17 00:00:00 2001 From: FATHIH MOHAMMED <99068504+FathihMohammed@users.noreply.github.com> Date: Thu, 9 Jan 2025 13:27:27 +0000 Subject: [PATCH 22/94] fix: precision loss causing process loss variance (cherry picked from commit d84601b2a3a96be811c6360e869b0864857c5fb7) --- erpnext/stock/doctype/stock_entry/stock_entry.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index 4b4ee6ad0f1..5dee819ad11 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -483,7 +483,7 @@ class StockEntry(StockController): if self.process_loss_qty: total += flt(self.process_loss_qty, precision) - if self.fg_completed_qty != total: + if self.fg_completed_qty != flt(total, precision): frappe.throw( _( "The finished product {0} quantity {1} and For Quantity {2} cannot be different" @@ -610,7 +610,9 @@ class StockEntry(StockController): completed_qty = ( d.completed_qty + d.process_loss_qty + (allowance_percentage / 100 * d.completed_qty) ) - if total_completed_qty > flt(completed_qty): + if flt(total_completed_qty, self.precision("fg_completed_qty")) > flt( + completed_qty, self.precision("fg_completed_qty") + ): job_card = frappe.db.get_value("Job Card", {"operation_id": d.name}, "name") if not job_card: frappe.throw( From d6614f284869eb87f30dfa5afd50ccdcbed64bd5 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Thu, 9 Jan 2025 13:10:00 +0530 Subject: [PATCH 23/94] fix: timeout error for work order (cherry picked from commit b4ceda6f2c88b0bd08e5cdf3f5a3f125442ac76d) (cherry picked from commit 122b966a7b78f78e1cd1a645824f33c0d5d797ff) --- .../manufacturing/doctype/job_card/job_card.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/erpnext/manufacturing/doctype/job_card/job_card.py b/erpnext/manufacturing/doctype/job_card/job_card.py index 011df3258ee..bc1076d1340 100644 --- a/erpnext/manufacturing/doctype/job_card/job_card.py +++ b/erpnext/manufacturing/doctype/job_card/job_card.py @@ -309,6 +309,9 @@ class JobCard(Document): return overlap def get_time_logs(self, args, doctype, open_job_cards=None): + if get_datetime(args.from_time) >= get_datetime(args.to_time): + args.to_time = add_to_date(args.from_time, minutes=args.remaining_time_in_mins) + jc = frappe.qb.DocType("Job Card") jctl = frappe.qb.DocType(doctype) @@ -354,8 +357,10 @@ class JobCard(Document): else: query = query.where(jc.name.isin(open_job_cards)) - if doctype != "Job Card Time Log": - query = query.where(jc.total_time_in_mins == 0) + if doctype == "Job Card Time Log": + query = query.where(jc.docstatus < 2) + else: + query = query.where((jc.docstatus == 0) & (jc.total_time_in_mins == 0)) time_logs = query.run(as_dict=True) @@ -412,7 +417,13 @@ class JobCard(Document): def schedule_time_logs(self, row): row.remaining_time_in_mins = row.time_in_mins while row.remaining_time_in_mins > 0: - args = frappe._dict({"from_time": row.planned_start_time, "to_time": row.planned_end_time}) + args = frappe._dict( + { + "from_time": row.planned_start_time, + "to_time": row.planned_end_time, + "remaining_time_in_mins": row.remaining_time_in_mins, + } + ) self.validate_overlap_for_workstation(args, row) self.check_workstation_time(row) From 625ff4b2760c25ee207cfff68cae3e7a65776c41 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Fri, 10 Jan 2025 06:31:50 +0000 Subject: [PATCH 24/94] chore(release): Bumped to Version 15.48.2 ## [15.48.2](https://github.com/frappe/erpnext/compare/v15.48.1...v15.48.2) (2025-01-10) ### Bug Fixes * precision loss causing process loss variance ([ac18c56](https://github.com/frappe/erpnext/commit/ac18c56a0bd13823d6aadae3b9461045647fb510)) * timeout error for work order ([d6614f2](https://github.com/frappe/erpnext/commit/d6614f284869eb87f30dfa5afd50ccdcbed64bd5)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 67248b1c1d6..da80a88a542 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.48.1" +__version__ = "15.48.2" def get_default_company(user=None): From 23b846ef39e1ddc0d7e0b44102d6e814d262cc0b Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Fri, 10 Jan 2025 14:20:48 +0530 Subject: [PATCH 25/94] fix: incorrect valuation rate for PI based revaluation (cherry picked from commit 14ce2337dff30616aa648c47fe827b16063a3e26) (cherry picked from commit f7e3854641246a16d33f1699c450fc975ddc8ba4) --- erpnext/stock/stock_ledger.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py index 1b299b52dd6..37e91080d5d 100644 --- a/erpnext/stock/stock_ledger.py +++ b/erpnext/stock/stock_ledger.py @@ -1039,7 +1039,7 @@ class update_entries_after: def get_dynamic_incoming_outgoing_rate(self, sle): # Get updated incoming/outgoing rate from transaction - if sle.recalculate_rate: + if sle.recalculate_rate or self.has_landed_cost_based_on_pi(sle): rate = self.get_incoming_outgoing_rate_from_transaction(sle) if flt(sle.actual_qty) >= 0: @@ -1047,6 +1047,14 @@ class update_entries_after: else: sle.outgoing_rate = rate + def has_landed_cost_based_on_pi(self, sle): + if sle.voucher_type == "Purchase Receipt" and frappe.db.get_single_value( + "Buying Settings", "set_landed_cost_based_on_purchase_invoice_rate" + ): + return True + + return False + def get_incoming_outgoing_rate_from_transaction(self, sle): rate = 0 # Material Transfer, Repack, Manufacturing From 47a622d0cb14f896cfc58154d37976cb6e729436 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Fri, 10 Jan 2025 18:19:48 +0530 Subject: [PATCH 26/94] fix: delivery_document_no column issue (cherry picked from commit 61efb2bb39a720b2d0fc98ff714b4477fcaa6dc5) # Conflicts: # erpnext/accounts/doctype/sales_invoice/sales_invoice.py # erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.py (cherry picked from commit 0df18080c7277bb773134f7fbcfab0fb0c6a1ba4) --- .../doctype/sales_invoice/sales_invoice.py | 7 ++-- .../sales_invoice_item/sales_invoice_item.py | 38 +++++++++++++++++++ .../doctype/delivery_note/delivery_note.py | 6 --- erpnext/stock/doctype/serial_no/serial_no.py | 15 -------- 4 files changed, 42 insertions(+), 24 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index cb501c1ffbc..ee18410a57b 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -321,9 +321,7 @@ class SalesInvoice(SellingController): self.set_against_income_account() self.validate_time_sheets_are_submitted() self.validate_multiple_billing("Delivery Note", "dn_detail", "amount") - if not self.is_return: - self.validate_serial_numbers() - else: + if self.is_return: self.timesheets = [] self.update_packing_list() self.set_billing_hours_and_amount() @@ -1706,6 +1704,7 @@ class SalesInvoice(SellingController): self.set("write_off_amount", reference_doc.get("write_off_amount")) self.due_date = None +<<<<<<< HEAD def validate_serial_numbers(self): """ validate serial number agains Delivery Note and Sales Invoice @@ -1753,6 +1752,8 @@ class SalesInvoice(SellingController): ) ) +======= +>>>>>>> 61efb2bb39 (fix: delivery_document_no column issue) def update_project(self): unique_projects = list(set([d.project for d in self.get("items") if d.project])) if self.project and self.project not in unique_projects: diff --git a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.py b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.py index b7b0873c76b..b96445e2c3a 100644 --- a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.py +++ b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.py @@ -3,6 +3,13 @@ from frappe.model.document import Document +<<<<<<< HEAD +======= +from frappe.utils.data import cint + +from erpnext.assets.doctype.asset.depreciation import get_disposal_account_and_cost_center +from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos +>>>>>>> 61efb2bb39 (fix: delivery_document_no column issue) class SalesInvoiceItem(Document): @@ -93,4 +100,35 @@ class SalesInvoiceItem(Document): weight_uom: DF.Link | None # end: auto-generated types +<<<<<<< HEAD pass +======= + def validate_cost_center(self, company: str): + cost_center_company = frappe.get_cached_value("Cost Center", self.cost_center, "company") + if cost_center_company != company: + frappe.throw( + _("Row #{0}: Cost Center {1} does not belong to company {2}").format( + frappe.bold(self.idx), frappe.bold(self.cost_center), frappe.bold(company) + ) + ) + + def set_actual_qty(self): + if self.item_code and self.warehouse: + self.actual_qty = ( + frappe.db.get_value( + "Bin", {"item_code": self.item_code, "warehouse": self.warehouse}, "actual_qty" + ) + or 0 + ) + + def set_income_account_for_fixed_asset(self, company: str): + """Set income account for fixed asset item based on company's disposal account and cost center.""" + if not self.is_fixed_asset: + return + + disposal_account, depreciation_cost_center = get_disposal_account_and_cost_center(company) + + self.income_account = disposal_account + if not self.cost_center: + self.cost_center = depreciation_cost_center +>>>>>>> 61efb2bb39 (fix: delivery_document_no column issue) diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py index 2b4dad137c2..76e5b4ea972 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/delivery_note.py @@ -12,7 +12,6 @@ from frappe.utils import cint, flt from erpnext.controllers.accounts_controller import get_taxes_and_charges, merge_taxes from erpnext.controllers.selling_controller import SellingController -from erpnext.stock.doctype.serial_no.serial_no import get_delivery_note_serial_no form_grid_templates = {"items": "templates/form_grid/item_grid.html"} @@ -980,11 +979,6 @@ def make_sales_invoice(source_name, target_doc=None, args=None): def update_item(source_doc, target_doc, source_parent): target_doc.qty = to_make_invoice_qty_map[source_doc.name] - if source_doc.serial_no and source_parent.per_billed > 0 and not source_parent.is_return: - target_doc.serial_no = get_delivery_note_serial_no( - source_doc.item_code, target_doc.qty, source_parent.name - ) - def get_pending_qty(item_row): pending_qty = item_row.qty - invoiced_qty_map.get(item_row.name, 0) diff --git a/erpnext/stock/doctype/serial_no/serial_no.py b/erpnext/stock/doctype/serial_no/serial_no.py index 4c693d8efec..54f96fb7b10 100644 --- a/erpnext/stock/doctype/serial_no/serial_no.py +++ b/erpnext/stock/doctype/serial_no/serial_no.py @@ -169,21 +169,6 @@ def update_maintenance_status(): frappe.db.set_value("Serial No", doc.name, "maintenance_status", doc.maintenance_status) -def get_delivery_note_serial_no(item_code, qty, delivery_note): - serial_nos = "" - dn_serial_nos = frappe.db.sql_list( - f""" select name from `tabSerial No` - where item_code = %(item_code)s and delivery_document_no = %(delivery_note)s - and sales_invoice is null limit {cint(qty)}""", - {"item_code": item_code, "delivery_note": delivery_note}, - ) - - if dn_serial_nos and len(dn_serial_nos) > 0: - serial_nos = "\n".join(dn_serial_nos) - - return serial_nos - - @frappe.whitelist() def auto_fetch_serial_number( qty: int, From 120bccdad3c19ae88f0e1bbf159d9995c87084a1 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Sat, 11 Jan 2025 10:59:26 +0530 Subject: [PATCH 27/94] chore: fix conflicts (cherry picked from commit 9426a3218465a9fac751b48a7d83b170f6d259f3) --- .../sales_invoice_item/sales_invoice_item.py | 38 ------------------- 1 file changed, 38 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.py b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.py index b96445e2c3a..b7b0873c76b 100644 --- a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.py +++ b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.py @@ -3,13 +3,6 @@ from frappe.model.document import Document -<<<<<<< HEAD -======= -from frappe.utils.data import cint - -from erpnext.assets.doctype.asset.depreciation import get_disposal_account_and_cost_center -from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos ->>>>>>> 61efb2bb39 (fix: delivery_document_no column issue) class SalesInvoiceItem(Document): @@ -100,35 +93,4 @@ class SalesInvoiceItem(Document): weight_uom: DF.Link | None # end: auto-generated types -<<<<<<< HEAD pass -======= - def validate_cost_center(self, company: str): - cost_center_company = frappe.get_cached_value("Cost Center", self.cost_center, "company") - if cost_center_company != company: - frappe.throw( - _("Row #{0}: Cost Center {1} does not belong to company {2}").format( - frappe.bold(self.idx), frappe.bold(self.cost_center), frappe.bold(company) - ) - ) - - def set_actual_qty(self): - if self.item_code and self.warehouse: - self.actual_qty = ( - frappe.db.get_value( - "Bin", {"item_code": self.item_code, "warehouse": self.warehouse}, "actual_qty" - ) - or 0 - ) - - def set_income_account_for_fixed_asset(self, company: str): - """Set income account for fixed asset item based on company's disposal account and cost center.""" - if not self.is_fixed_asset: - return - - disposal_account, depreciation_cost_center = get_disposal_account_and_cost_center(company) - - self.income_account = disposal_account - if not self.cost_center: - self.cost_center = depreciation_cost_center ->>>>>>> 61efb2bb39 (fix: delivery_document_no column issue) From 85c2d32de69bc87322e34f4dca876860ac9c282c Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Sat, 11 Jan 2025 11:00:20 +0530 Subject: [PATCH 28/94] chore: fix conflicts (cherry picked from commit bb170c024fcce26ef64e0afc2c30344f2b63e98a) --- .../doctype/sales_invoice/sales_invoice.py | 50 ------------------- 1 file changed, 50 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index ee18410a57b..174a80d4d75 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -1704,56 +1704,6 @@ class SalesInvoice(SellingController): self.set("write_off_amount", reference_doc.get("write_off_amount")) self.due_date = None -<<<<<<< HEAD - def validate_serial_numbers(self): - """ - validate serial number agains Delivery Note and Sales Invoice - """ - self.set_serial_no_against_delivery_note() - self.validate_serial_against_delivery_note() - - def set_serial_no_against_delivery_note(self): - for item in self.items: - if item.serial_no and item.delivery_note and item.qty != len(get_serial_nos(item.serial_no)): - item.serial_no = get_delivery_note_serial_no(item.item_code, item.qty, item.delivery_note) - - def validate_serial_against_delivery_note(self): - """ - validate if the serial numbers in Sales Invoice Items are same as in - Delivery Note Item - """ - - for item in self.items: - if not item.delivery_note or not item.dn_detail: - continue - - serial_nos = frappe.db.get_value("Delivery Note Item", item.dn_detail, "serial_no") or "" - dn_serial_nos = set(get_serial_nos(serial_nos)) - - serial_nos = item.serial_no or "" - si_serial_nos = set(get_serial_nos(serial_nos)) - serial_no_diff = si_serial_nos - dn_serial_nos - - if serial_no_diff: - dn_link = frappe.utils.get_link_to_form("Delivery Note", item.delivery_note) - serial_no_msg = ", ".join(frappe.bold(d) for d in serial_no_diff) - - msg = _("Row #{0}: The following Serial Nos are not present in Delivery Note {1}:").format( - item.idx, dn_link - ) - msg += " " + serial_no_msg - - frappe.throw(msg=msg, title=_("Serial Nos Mismatch")) - - if item.serial_no and cint(item.qty) != len(si_serial_nos): - frappe.throw( - _("Row #{0}: {1} Serial numbers required for Item {2}. You have provided {3}.").format( - item.idx, item.qty, item.item_code, len(si_serial_nos) - ) - ) - -======= ->>>>>>> 61efb2bb39 (fix: delivery_document_no column issue) def update_project(self): unique_projects = list(set([d.project for d in self.get("items") if d.project])) if self.project and self.project not in unique_projects: From b75c7364d605c0ac88f633d22d4e3d25d09c555c Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Sat, 11 Jan 2025 11:06:13 +0530 Subject: [PATCH 29/94] fix: test case (cherry picked from commit 7d66e4efb0bdb7c109347ea7504b09f08858bfcb) --- erpnext/accounts/doctype/sales_invoice/sales_invoice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 174a80d4d75..c9a36e4aece 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -39,7 +39,7 @@ from erpnext.controllers.selling_controller import SellingController from erpnext.projects.doctype.timesheet.timesheet import get_projectwise_timesheet_data from erpnext.setup.doctype.company.company import update_company_current_month_sales from erpnext.stock.doctype.delivery_note.delivery_note import update_billed_amount_based_on_so -from erpnext.stock.doctype.serial_no.serial_no import get_delivery_note_serial_no, get_serial_nos +from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos form_grid_templates = {"items": "templates/form_grid/item_grid.html"} From 74650217c1ffb0cf37ff2a604e1ce882796c017d Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Mon, 13 Jan 2025 08:20:40 +0000 Subject: [PATCH 30/94] chore(release): Bumped to Version 15.48.3 ## [15.48.3](https://github.com/frappe/erpnext/compare/v15.48.2...v15.48.3) (2025-01-13) ### Bug Fixes * delivery_document_no column issue ([47a622d](https://github.com/frappe/erpnext/commit/47a622d0cb14f896cfc58154d37976cb6e729436)) * incorrect valuation rate for PI based revaluation ([23b846e](https://github.com/frappe/erpnext/commit/23b846ef39e1ddc0d7e0b44102d6e814d262cc0b)) * test case ([b75c736](https://github.com/frappe/erpnext/commit/b75c7364d605c0ac88f633d22d4e3d25d09c555c)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index da80a88a542..d08d8de1832 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.48.2" +__version__ = "15.48.3" def get_default_company(user=None): From d1fee96f75efedd45024e4d6d581c9c3f687594a Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 15 Jan 2025 12:28:46 +0000 Subject: [PATCH 31/94] chore(release): Bumped to Version 15.48.4 ## [15.48.4](https://github.com/frappe/erpnext/compare/v15.48.3...v15.48.4) (2025-01-15) ### Bug Fixes * auto fetch batch and serial no for draft stock transactions ([2f2554e](https://github.com/frappe/erpnext/commit/2f2554e9e55c8ab8c758800dc2dc75ab4246ef78)) * batch number search on pos ([#45209](https://github.com/frappe/erpnext/issues/45209)) ([fe5c458](https://github.com/frappe/erpnext/commit/fe5c458c4525915939369466bac222aa6b9bbd54)) * change string to be able to translate ([#45090](https://github.com/frappe/erpnext/issues/45090)) ([7a3687c](https://github.com/frappe/erpnext/commit/7a3687ca8e0e674a107893356d70a159e0ffe12d)) * deduct tds on excess amount if checked ([07c3605](https://github.com/frappe/erpnext/commit/07c3605905d9490dd890645a1872e47eb3edd631)) * delivery_document_no column issue ([0df1808](https://github.com/frappe/erpnext/commit/0df18080c7277bb773134f7fbcfab0fb0c6a1ba4)) * do not add ordered items from Quotation to new Sales Order ([f414fa4](https://github.com/frappe/erpnext/commit/f414fa4981da572d1ef07d44b2aba006c2d03c81)) * don't create invoice if invoice start date is in future ([3f6d774](https://github.com/frappe/erpnext/commit/3f6d7741d9c939c5242de26256b138c711e65680)) * incorrect label in Item-wise sales register ([36d1fbd](https://github.com/frappe/erpnext/commit/36d1fbd6a31f21f17b000ed16a2314fa1119cfe1)) * incorrect valuation for sales return with different warhouse ([9ee5651](https://github.com/frappe/erpnext/commit/9ee5651848cd46782d8c33d567ffc404ee4f060f)) * incorrect valuation rate for PI based revaluation ([f7e3854](https://github.com/frappe/erpnext/commit/f7e3854641246a16d33f1699c450fc975ddc8ba4)) * linter issue ([af21bca](https://github.com/frappe/erpnext/commit/af21bca2318089bfee543fdf2180e9d55c7f2833)) * minor update for readability ([abfcfdf](https://github.com/frappe/erpnext/commit/abfcfdfe7e9ba2782fe035f0f7e0a3a73f5cac0e)) * not able to see create Quality Inspection button ([a79cae1](https://github.com/frappe/erpnext/commit/a79cae1fefb31e85b59bc2993ef5497d1e2bab31)) * pass right existing address ([80e6112](https://github.com/frappe/erpnext/commit/80e6112549e4464c8d736c385113966672109359)) * precision loss causing process loss variance ([d84601b](https://github.com/frappe/erpnext/commit/d84601b2a3a96be811c6360e869b0864857c5fb7)) * Semgrep rules ([1d5a73a](https://github.com/frappe/erpnext/commit/1d5a73a325b5d3c7c2cd7660ec066e3cf95f32e4)) * set billing and shipping address on change of company ([42eb88f](https://github.com/frappe/erpnext/commit/42eb88f5f60ddb556ba7582d253b75abbd601c6e)) * Skip WIP Warehouse transfer ([bb0695a](https://github.com/frappe/erpnext/commit/bb0695a8833ed16b3e7e0a5fd1511c419b6274e2)) * test case ([f5667f5](https://github.com/frappe/erpnext/commit/f5667f56e41a023b5e9b9e6ed26570314e2bc907)) * test case ([7d66e4e](https://github.com/frappe/erpnext/commit/7d66e4efb0bdb7c109347ea7504b09f08858bfcb)) * tests ([8ba42cf](https://github.com/frappe/erpnext/commit/8ba42cfbf09fec58f4ac360ecfb8e9cce36933c9)) * timeout error for work order ([122b966](https://github.com/frappe/erpnext/commit/122b966a7b78f78e1cd1a645824f33c0d5d797ff)) * **Timesheet:** ignore permissions when updating Task and Project (backport [#45168](https://github.com/frappe/erpnext/issues/45168)) ([#45170](https://github.com/frappe/erpnext/issues/45170)) ([f7448c6](https://github.com/frappe/erpnext/commit/f7448c6f793148e3f197cbef4d0ada6d0e9d2bc6)) * typo in manufacturing settings (backport [#45190](https://github.com/frappe/erpnext/issues/45190)) ([#45193](https://github.com/frappe/erpnext/issues/45193)) ([47c6e5a](https://github.com/frappe/erpnext/commit/47c6e5a931c8f16198f4be76a1ca1f97323857f3)) * update discounting on mixed conditions ([38cb5a9](https://github.com/frappe/erpnext/commit/38cb5a98bfb7cd85f09f9363c6fbfe823c253a28)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index d08d8de1832..98fb6684f2d 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.48.3" +__version__ = "15.48.4" def get_default_company(user=None): From b9fcc786fa03681c2441016a4e72eed48b75cf06 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 22 Jan 2025 03:32:58 +0000 Subject: [PATCH 32/94] chore(release): Bumped to Version 15.49.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # [15.49.0](https://github.com/frappe/erpnext/compare/v15.48.4...v15.49.0) (2025-01-22) ### Bug Fixes * Ambiguous column error while creating Sales Return ([#45275](https://github.com/frappe/erpnext/issues/45275)) ([842d72f](https://github.com/frappe/erpnext/commit/842d72f7c442cd473c100fc3890c956a4e7ae33c)) * apply ruff formatter changes ([8e33d93](https://github.com/frappe/erpnext/commit/8e33d9327383075304afc8c22e632a04b5a365a6)) * calculate AED exchange rate based on pegged value with USD ([05e4255](https://github.com/frappe/erpnext/commit/05e42558d1e7a38b70dc2ade8865a5b45c271be2)) * check if tds deducted based on Purchase Taxes and Charges ([#45161](https://github.com/frappe/erpnext/issues/45161)) ([ade8799](https://github.com/frappe/erpnext/commit/ade8799358896043fdd77869dd03b0c90f45c536)) * check if tds deducted based on Purchase Taxes and Charges (backport [#45161](https://github.com/frappe/erpnext/issues/45161)) ([#45277](https://github.com/frappe/erpnext/issues/45277)) ([3abca03](https://github.com/frappe/erpnext/commit/3abca03fc1b4d73d1db68012386cc9fbc86db105)) * company in quality inspection ([c0cf1fe](https://github.com/frappe/erpnext/commit/c0cf1fed0058f6ce90871275a99fc7cb83a0c627)) * conflict ([bdaf376](https://github.com/frappe/erpnext/commit/bdaf3761c064150f8705a61234261d01c00788b6)) * do not reset picked items ([fd83b52](https://github.com/frappe/erpnext/commit/fd83b5251302a83eba332d35198f60d9aec2a6a2)) * Does not allow to create Sub-Asseblies of Sub Assemblies ([d3c9092](https://github.com/frappe/erpnext/commit/d3c9092266180f8b233ea0d93b8616187c0ff28a)) * ensure multiple PCVs in same fiscal year are considered in patch ([fcd914c](https://github.com/frappe/erpnext/commit/fcd914cfa0117a60309d991f51b2f9f99c1be7fb)) * fetching items from blanket order to sales/purchase order ([#45262](https://github.com/frappe/erpnext/issues/45262)) ([7fc19e1](https://github.com/frappe/erpnext/commit/7fc19e19be0e9d8c3ac4ac0c26edf1483f9c7b1f)) * fixed typo in manufacturing settings and field rename ([#45238](https://github.com/frappe/erpnext/issues/45238)) ([7641627](https://github.com/frappe/erpnext/commit/7641627b717ead4e2bcb35030ba654be6ca0f714)) * getting scrap items from sub assemblies by fetching scrap items for parent BOM ([da7b691](https://github.com/frappe/erpnext/commit/da7b69109a4b3a5f5d8e1ac130008918e8a6763f)) * ignore crm deal in tax_rule search filter (backport [#45134](https://github.com/frappe/erpnext/issues/45134)) ([#45138](https://github.com/frappe/erpnext/issues/45138)) ([afab5be](https://github.com/frappe/erpnext/commit/afab5be63fbe58ff169d0b941cc096455db9756a)) * include pos invoice in modifing key for returned item validation ([70ed8b7](https://github.com/frappe/erpnext/commit/70ed8b78d25c336d86482e15ff714d6a0d27b8f8)) * linters ([61303db](https://github.com/frappe/erpnext/commit/61303db16d77483df6b9ece033e3367f46b9107a)) * precision on work order total qty ([#45341](https://github.com/frappe/erpnext/issues/45341)) ([5346820](https://github.com/frappe/erpnext/commit/53468202dec4a97f004d85e850112911b126d60d)) * **Project:** re-phrase welcome email ([#45175](https://github.com/frappe/erpnext/issues/45175)) ([c94430a](https://github.com/frappe/erpnext/commit/c94430a4722e99b9ab4530872408b5261eda36e1)) * round off tax withholding amount ([#45271](https://github.com/frappe/erpnext/issues/45271)) ([3c10d80](https://github.com/frappe/erpnext/commit/3c10d809b0f88d372793c5dd8be218c0dc01be73)) * sales return for multi-uom ([#45303](https://github.com/frappe/erpnext/issues/45303)) ([e965b6e](https://github.com/frappe/erpnext/commit/e965b6ef4584181ab8582901d1cfff6365421cd4)) * set invoice start date to subscription start date (backport [#45342](https://github.com/frappe/erpnext/issues/45342)) ([#45343](https://github.com/frappe/erpnext/issues/45343)) ([7045c2c](https://github.com/frappe/erpnext/commit/7045c2cc3d2b1a0956e060c7a1c26c0c1884ef72)) * status of the serial no for the raw materials ([d956051](https://github.com/frappe/erpnext/commit/d956051e69d441797ef08ebb193b70c167f2556e)) * translation fixes ([e4f09ce](https://github.com/frappe/erpnext/commit/e4f09ce5434127d3f720d6e03c390cc6ddf5e75d)) * updated modified timestamp for stock entry type (backport [#45280](https://github.com/frappe/erpnext/issues/45280)) ([#45315](https://github.com/frappe/erpnext/issues/45315)) ([96a3a45](https://github.com/frappe/erpnext/commit/96a3a45078548ed9aa1e78d7524006213e9a8038)) * use currency defined in plan for subscription invoice ([#45104](https://github.com/frappe/erpnext/issues/45104)) ([a27eac1](https://github.com/frappe/erpnext/commit/a27eac1ef648d540bebb0b752b69132664b7153d)) * use currency defined in plan for subscription invoice (backport [#45104](https://github.com/frappe/erpnext/issues/45104)) ([#45273](https://github.com/frappe/erpnext/issues/45273)) ([2c46be4](https://github.com/frappe/erpnext/commit/2c46be4cfbf888c337316df1b7fbe87b818de877)) * validate linked sales person ([85910ec](https://github.com/frappe/erpnext/commit/85910ec2f99f9bcb7c7ab1ffbe6fe01ecf312d9c)) ### Features * add option to update modified on communication recieved (backport [#45307](https://github.com/frappe/erpnext/issues/45307)) ([#45310](https://github.com/frappe/erpnext/issues/45310)) ([bf8d6ae](https://github.com/frappe/erpnext/commit/bf8d6ae6bf074a5282d043480e5cb8a141021557)) * add Syscohada charts of accounts ([2667649](https://github.com/frappe/erpnext/commit/26676491e5b57245fa9cd30bceb5758a334434cf)) * Added valuation of quantity for each age group in stock ageing … (backport [#45076](https://github.com/frappe/erpnext/issues/45076)) ([#45208](https://github.com/frappe/erpnext/issues/45208)) ([dd58e4c](https://github.com/frappe/erpnext/commit/dd58e4cb536503427beb14fb619a10648694dc8c)) ### Performance Improvements * Ignore is_opening column in GL Queries ([#45327](https://github.com/frappe/erpnext/issues/45327)) ([b7de26d](https://github.com/frappe/erpnext/commit/b7de26d12353e2aba3587f50b35dd15b12426a30)) ### Reverts * avoid change to translatable string ([93e3847](https://github.com/frappe/erpnext/commit/93e3847e36ee865580d707aeb3fa3640a32145f6)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 98fb6684f2d..0c4cf74fc53 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.48.4" +__version__ = "15.49.0" def get_default_company(user=None): From 5d045014547c4702bc912f82a7831850f4a0b9bc Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Wed, 22 Jan 2025 13:46:37 +0530 Subject: [PATCH 33/94] fix: Do no query GLs if no PCVs are posted (cherry picked from commit f4d1a5458855d49d0d7626b553d6bf2a21ab6449) --- erpnext/patches/v14_0/update_closing_balances.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/erpnext/patches/v14_0/update_closing_balances.py b/erpnext/patches/v14_0/update_closing_balances.py index e6544485252..2a081329ce3 100644 --- a/erpnext/patches/v14_0/update_closing_balances.py +++ b/erpnext/patches/v14_0/update_closing_balances.py @@ -18,10 +18,12 @@ def execute(): frappe.db.truncate("Account Closing Balance") pcv_list = get_period_closing_vouchers() - gl_entries = get_gl_entries(pcv_list) - for _, pcvs in itertools.groupby(pcv_list, key=lambda pcv: (pcv.company, pcv.period_start_date)): - process_grouped_pcvs(list(pcvs), gl_entries) + if pcv_list: + gl_entries = get_gl_entries(pcv_list) + + for _, pcvs in itertools.groupby(pcv_list, key=lambda pcv: (pcv.company, pcv.period_start_date)): + process_grouped_pcvs(list(pcvs), gl_entries) def process_grouped_pcvs(pcvs, gl_entries): From 89f783451781f14ed9362387eae9b6dea5034ae0 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 22 Jan 2025 09:18:16 +0000 Subject: [PATCH 34/94] chore(release): Bumped to Version 15.49.1 ## [15.49.1](https://github.com/frappe/erpnext/compare/v15.49.0...v15.49.1) (2025-01-22) ### Bug Fixes * Do no query GLs if no PCVs are posted ([5d04501](https://github.com/frappe/erpnext/commit/5d045014547c4702bc912f82a7831850f4a0b9bc)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 0c4cf74fc53..10aa99559b7 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.49.0" +__version__ = "15.49.1" def get_default_company(user=None): From 42f7ee905ca9a0ebfc5bfa145c7a9af8ba736307 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 23 Jan 2025 11:17:14 +0530 Subject: [PATCH 35/94] fix: batch qty calculation (backport #45367) (#45388) fix: batch qty calculation (cherry picked from commit f07a71a882d940db3d1c1e28c011410fdb279aa3) Co-authored-by: Rohit Waghchaure (cherry picked from commit 767529f0ec4d982e2eaba40de00b39234c400fda) --- .../accounts/doctype/pos_invoice/test_pos_invoice.py | 3 ++- erpnext/stock/serial_batch_bundle.py | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py b/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py index 1dbc630e62e..7b6b8b50543 100644 --- a/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py +++ b/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py @@ -835,7 +835,8 @@ class TestPOSInvoice(unittest.TestCase): { "item_code": item.name, "warehouse": pos_inv2.items[0].warehouse, - "voucher_type": "Delivery Note", + "voucher_type": "POS Invoice", + "voucher_no": pos_inv2.name, "qty": 2, "avg_rate": 300, "batches": frappe._dict({"TestBatch 01": 2}), diff --git a/erpnext/stock/serial_batch_bundle.py b/erpnext/stock/serial_batch_bundle.py index 59c299de352..85adb0348d9 100644 --- a/erpnext/stock/serial_batch_bundle.py +++ b/erpnext/stock/serial_batch_bundle.py @@ -6,6 +6,7 @@ from frappe.model.naming import make_autoname from frappe.query_builder.functions import CombineDatetime, Sum, Timestamp from frappe.utils import add_days, cint, cstr, flt, get_link_to_form, now, nowtime, today from pypika import Order +from pypika.terms import ExistsCriterion from erpnext.stock.deprecated_serial_batch import ( DeprecatedBatchNoValuation, @@ -650,6 +651,7 @@ class BatchNoValuation(DeprecatedBatchNoValuation): parent = frappe.qb.DocType("Serial and Batch Bundle") child = frappe.qb.DocType("Serial and Batch Entry") + sle = frappe.qb.DocType("Stock Ledger Entry") timestamp_condition = "" if self.sle.posting_date: @@ -682,6 +684,14 @@ class BatchNoValuation(DeprecatedBatchNoValuation): & (parent.docstatus == 1) & (parent.is_cancelled == 0) & (parent.type_of_transaction.isin(["Inward", "Outward"])) + & ( + ExistsCriterion( + frappe.qb.from_(sle) + .select(sle.name) + .where((parent.name == sle.serial_and_batch_bundle) & (sle.is_cancelled == 0)) + ) + | (parent.voucher_type == "POS Invoice") + ) ) .groupby(child.batch_no) ) From 4542a759aec98e5f4f6d91ddb1a6a819ff007b9a Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Thu, 23 Jan 2025 13:03:37 +0530 Subject: [PATCH 36/94] fix: JobCardTimeLog' object has no attribute 'remaining_time_in_mins' (cherry picked from commit 41dda35db73deb56820e9f9a4a12535077c46b7d) (cherry picked from commit ef15429d98a615d745542b485ee010797a1c800c) --- erpnext/manufacturing/doctype/job_card/job_card.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/manufacturing/doctype/job_card/job_card.py b/erpnext/manufacturing/doctype/job_card/job_card.py index bc1076d1340..a1b53fb7c4a 100644 --- a/erpnext/manufacturing/doctype/job_card/job_card.py +++ b/erpnext/manufacturing/doctype/job_card/job_card.py @@ -309,8 +309,8 @@ class JobCard(Document): return overlap def get_time_logs(self, args, doctype, open_job_cards=None): - if get_datetime(args.from_time) >= get_datetime(args.to_time): - args.to_time = add_to_date(args.from_time, minutes=args.remaining_time_in_mins) + if args.get("remaining_time_in_mins") and get_datetime(args.from_time) >= get_datetime(args.to_time): + args.to_time = add_to_date(args.from_time, minutes=args.get("remaining_time_in_mins")) jc = frappe.qb.DocType("Job Card") jctl = frappe.qb.DocType(doctype) From 457340886607a1b0041d54501800111555e64c43 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Thu, 23 Jan 2025 08:43:35 +0000 Subject: [PATCH 37/94] chore(release): Bumped to Version 15.49.2 ## [15.49.2](https://github.com/frappe/erpnext/compare/v15.49.1...v15.49.2) (2025-01-23) ### Bug Fixes * batch qty calculation (backport [#45367](https://github.com/frappe/erpnext/issues/45367)) ([#45388](https://github.com/frappe/erpnext/issues/45388)) ([42f7ee9](https://github.com/frappe/erpnext/commit/42f7ee905ca9a0ebfc5bfa145c7a9af8ba736307)) * JobCardTimeLog' object has no attribute 'remaining_time_in_mins' ([4542a75](https://github.com/frappe/erpnext/commit/4542a759aec98e5f4f6d91ddb1a6a819ff007b9a)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 10aa99559b7..d6291128b25 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.49.1" +__version__ = "15.49.2" def get_default_company(user=None): From c6bc5f5d7d7f5d0f5c0e07219234e0ad717b8b70 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 19 Dec 2024 13:40:03 +0530 Subject: [PATCH 38/94] refactor: configurable posting date for Exc Gain / Loss journal (cherry picked from commit 3fbd2ca0d9d9cef759669050964e2faa63af2429) --- .../doctype/accounts_settings/accounts_settings.json | 11 ++++++++++- .../doctype/accounts_settings/accounts_settings.py | 1 + .../payment_reconciliation/payment_reconciliation.py | 5 +++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/accounts_settings/accounts_settings.json b/erpnext/accounts/doctype/accounts_settings/accounts_settings.json index 6250250a170..097ae89caaf 100644 --- a/erpnext/accounts/doctype/accounts_settings/accounts_settings.json +++ b/erpnext/accounts/doctype/accounts_settings/accounts_settings.json @@ -47,6 +47,7 @@ "auto_reconciliation_job_trigger", "reconciliation_queue_size", "column_break_resa", + "exchange_gain_loss_posting_date", "invoicing_settings_tab", "accounts_transactions_settings_section", "over_billing_allowance", @@ -523,6 +524,14 @@ "fieldname": "ignore_is_opening_check_for_reporting", "fieldtype": "Check", "label": "Ignore Is Opening check for reporting" + }, + { + "default": "Payment", + "description": "Only applies for Normal Payments", + "fieldname": "exchange_gain_loss_posting_date", + "fieldtype": "Select", + "label": "Posting Date Inheritance for Exchange Gain / Loss", + "options": "Invoice\nPayment" } ], "icon": "icon-cog", @@ -530,7 +539,7 @@ "index_web_pages_for_search": 1, "issingle": 1, "links": [], - "modified": "2025-01-18 21:24:19.840745", + "modified": "2025-01-22 17:53:47.968079", "modified_by": "Administrator", "module": "Accounts", "name": "Accounts Settings", diff --git a/erpnext/accounts/doctype/accounts_settings/accounts_settings.py b/erpnext/accounts/doctype/accounts_settings/accounts_settings.py index 590422c6224..f3aca158486 100644 --- a/erpnext/accounts/doctype/accounts_settings/accounts_settings.py +++ b/erpnext/accounts/doctype/accounts_settings/accounts_settings.py @@ -45,6 +45,7 @@ class AccountsSettings(Document): enable_fuzzy_matching: DF.Check enable_immutable_ledger: DF.Check enable_party_matching: DF.Check + exchange_gain_loss_posting_date: DF.Literal["Invoice", "Payment"] frozen_accounts_modifier: DF.Link | None general_ledger_remarks_length: DF.Int ignore_account_closing_balance: DF.Check diff --git a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py index db4a4b0f268..5577f4fffda 100644 --- a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py +++ b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py @@ -424,6 +424,9 @@ class PaymentReconciliation(Document): def allocate_entries(self, args): self.validate_entries() + exc_gain_loss_posting_date = frappe.db.get_single_value( + "Accounts Settings", "exchange_gain_loss_posting_date", cache=True + ) invoice_exchange_map = self.get_invoice_exchange_map(args.get("invoices"), args.get("payments")) default_exchange_gain_loss_account = frappe.get_cached_value( "Company", self.company, "exchange_gain_loss_account" @@ -450,6 +453,8 @@ class PaymentReconciliation(Document): res.difference_account = default_exchange_gain_loss_account res.exchange_rate = inv.get("exchange_rate") res.update({"gain_loss_posting_date": pay.get("posting_date")}) + if exc_gain_loss_posting_date == "Invoice": + res.update({"gain_loss_posting_date": inv.get("invoice_date")}) if pay.get("amount") == 0: entries.append(res) From c127cbac571f4f82f6232b1b593a8cd69e115fdf Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 19 Dec 2024 13:40:03 +0530 Subject: [PATCH 39/94] refactor: configurable posting date for Exc Gain / Loss journal (cherry picked from commit 5257413a932f4a9eb1331d5fca6110390531fadf) --- .../accounts/doctype/accounts_settings/accounts_settings.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/accounts_settings/accounts_settings.json b/erpnext/accounts/doctype/accounts_settings/accounts_settings.json index 097ae89caaf..a3e2fe82c8e 100644 --- a/erpnext/accounts/doctype/accounts_settings/accounts_settings.json +++ b/erpnext/accounts/doctype/accounts_settings/accounts_settings.json @@ -390,7 +390,7 @@ { "fieldname": "section_break_jpd0", "fieldtype": "Section Break", - "label": "Payment Reconciliations" + "label": "Payment Reconciliation Settings" }, { "default": "0", @@ -568,4 +568,4 @@ "sort_order": "ASC", "states": [], "track_changes": 1 -} \ No newline at end of file +} From d955986342d144de392208a3690f35b3a47204d4 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 23 Jan 2025 13:48:09 +0530 Subject: [PATCH 40/94] refactor: allow reconciliation date for exchange gain / loss (cherry picked from commit 95af63e305c51a19bfea43c7f9580c68fb93433e) --- .../doctype/accounts_settings/accounts_settings.json | 6 +++--- .../accounts/doctype/accounts_settings/accounts_settings.py | 2 +- .../payment_reconciliation/payment_reconciliation.py | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/doctype/accounts_settings/accounts_settings.json b/erpnext/accounts/doctype/accounts_settings/accounts_settings.json index a3e2fe82c8e..3f343f610e0 100644 --- a/erpnext/accounts/doctype/accounts_settings/accounts_settings.json +++ b/erpnext/accounts/doctype/accounts_settings/accounts_settings.json @@ -531,7 +531,7 @@ "fieldname": "exchange_gain_loss_posting_date", "fieldtype": "Select", "label": "Posting Date Inheritance for Exchange Gain / Loss", - "options": "Invoice\nPayment" + "options": "Invoice\nPayment\nReconciliation Date" } ], "icon": "icon-cog", @@ -539,7 +539,7 @@ "index_web_pages_for_search": 1, "issingle": 1, "links": [], - "modified": "2025-01-22 17:53:47.968079", + "modified": "2025-01-23 13:15:44.077853", "modified_by": "Administrator", "module": "Accounts", "name": "Accounts Settings", @@ -568,4 +568,4 @@ "sort_order": "ASC", "states": [], "track_changes": 1 -} +} \ No newline at end of file diff --git a/erpnext/accounts/doctype/accounts_settings/accounts_settings.py b/erpnext/accounts/doctype/accounts_settings/accounts_settings.py index f3aca158486..31249e22455 100644 --- a/erpnext/accounts/doctype/accounts_settings/accounts_settings.py +++ b/erpnext/accounts/doctype/accounts_settings/accounts_settings.py @@ -45,7 +45,7 @@ class AccountsSettings(Document): enable_fuzzy_matching: DF.Check enable_immutable_ledger: DF.Check enable_party_matching: DF.Check - exchange_gain_loss_posting_date: DF.Literal["Invoice", "Payment"] + exchange_gain_loss_posting_date: DF.Literal["Invoice", "Payment", "Reconciliation Date"] frozen_accounts_modifier: DF.Link | None general_ledger_remarks_length: DF.Int ignore_account_closing_balance: DF.Check diff --git a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py index 5577f4fffda..d3d89a1c1cc 100644 --- a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py +++ b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py @@ -455,6 +455,8 @@ class PaymentReconciliation(Document): res.update({"gain_loss_posting_date": pay.get("posting_date")}) if exc_gain_loss_posting_date == "Invoice": res.update({"gain_loss_posting_date": inv.get("invoice_date")}) + elif exc_gain_loss_posting_date == "Reconciliation Date": + res.update({"gain_loss_posting_date": nowdate()}) if pay.get("amount") == 0: entries.append(res) From ccaf0d4b858b5fe65863a0da2c84eab3d19bb882 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 23 Jan 2025 14:10:15 +0530 Subject: [PATCH 41/94] refactor: only apply configuration on normal payments patch to update default value (cherry picked from commit b2c3da135ea85fe245ec9c6066a8e68b42b64f7f) --- .../payment_reconciliation/payment_reconciliation.py | 10 ++++++---- erpnext/controllers/accounts_controller.py | 2 ++ erpnext/patches.txt | 1 + 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py index d3d89a1c1cc..72aa4905900 100644 --- a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py +++ b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py @@ -335,6 +335,7 @@ class PaymentReconciliation(Document): for payment in non_reconciled_payments: row = self.append("payments", {}) row.update(payment) + row.is_advance = payment.book_advance_payments_in_separate_party_account def get_invoice_entries(self): # Fetch JVs, Sales and Purchase Invoices for 'invoices' to reconcile against @@ -453,10 +454,11 @@ class PaymentReconciliation(Document): res.difference_account = default_exchange_gain_loss_account res.exchange_rate = inv.get("exchange_rate") res.update({"gain_loss_posting_date": pay.get("posting_date")}) - if exc_gain_loss_posting_date == "Invoice": - res.update({"gain_loss_posting_date": inv.get("invoice_date")}) - elif exc_gain_loss_posting_date == "Reconciliation Date": - res.update({"gain_loss_posting_date": nowdate()}) + if not pay.get("is_advance"): + if exc_gain_loss_posting_date == "Invoice": + res.update({"gain_loss_posting_date": inv.get("invoice_date")}) + elif exc_gain_loss_posting_date == "Reconciliation Date": + res.update({"gain_loss_posting_date": nowdate()}) if pay.get("amount") == 0: entries.append(res) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 7074710dfee..b687914600b 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -2969,6 +2969,7 @@ def get_advance_payment_entries( (payment_ref.allocated_amount).as_("amount"), (payment_ref.name).as_("reference_row"), (payment_ref.reference_name).as_("against_order"), + (payment_entry.book_advance_payments_in_separate_party_account), ) q = q.where(payment_ref.reference_doctype == order_doctype) @@ -3013,6 +3014,7 @@ def get_common_query( (payment_entry.name).as_("reference_name"), payment_entry.posting_date, (payment_entry.remarks).as_("remarks"), + (payment_entry.book_advance_payments_in_separate_party_account), ) .where(payment_entry.payment_type == payment_type) .where(payment_entry.party_type == party_type) diff --git a/erpnext/patches.txt b/erpnext/patches.txt index f0cc713ba0b..f40801e2776 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -390,3 +390,4 @@ erpnext.patches.v15_0.update_asset_status_to_work_in_progress erpnext.patches.v15_0.rename_manufacturing_settings_field erpnext.patches.v15_0.migrate_checkbox_to_select_for_reconciliation_effect erpnext.patches.v15_0.sync_auto_reconcile_config +execute:frappe.db.set_single_value("Accounts Settings", "exchange_gain_loss_posting_date", "Payment") From c90d33acc3cb2b92ab2a4eea0f7f48d43db4c461 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 23 Jan 2025 14:44:40 +0530 Subject: [PATCH 42/94] test: exc gain/loss posting date based on configuration (cherry picked from commit 2f3281579a5b4393ff336e7e2ff274d0b60c5d66) --- .../tests/test_accounts_controller.py | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/erpnext/controllers/tests/test_accounts_controller.py b/erpnext/controllers/tests/test_accounts_controller.py index e557a6b2d79..0c1049f0f0e 100644 --- a/erpnext/controllers/tests/test_accounts_controller.py +++ b/erpnext/controllers/tests/test_accounts_controller.py @@ -9,6 +9,7 @@ from frappe import qb from frappe.query_builder.functions import Sum from frappe.tests.utils import FrappeTestCase, change_settings from frappe.utils import add_days, getdate, nowdate +from frappe.utils.data import getdate as convert_to_date from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry from erpnext.accounts.doctype.payment_entry.test_payment_entry import create_payment_entry @@ -868,6 +869,69 @@ class TestAccountsController(FrappeTestCase): self.assertEqual(pi.items[0].rate, arms_length_price) self.assertEqual(pi.items[0].valuation_rate, 100) + @IntegrationTestCase.change_settings( + "Accounts Settings", {"exchange_gain_loss_posting_date": "Reconciliation Date"} + ) + def test_17_gain_loss_posting_date_for_normal_payment(self): + # Sales Invoice in Foreign Currency + rate = 80 + rate_in_account_currency = 1 + + adv_date = convert_to_date(add_days(nowdate(), -2)) + inv_date = convert_to_date(add_days(nowdate(), -1)) + + si = self.create_sales_invoice(posting_date=inv_date, qty=1, rate=rate_in_account_currency) + + # Test payments with different exchange rates + pe = self.create_payment_entry(posting_date=adv_date, amount=1, source_exc_rate=75.1).save().submit() + + pr = self.create_payment_reconciliation() + pr.from_invoice_date = add_days(nowdate(), -1) + pr.to_invoice_date = nowdate() + pr.from_payment_date = add_days(nowdate(), -2) + pr.to_payment_date = nowdate() + + pr.get_unreconciled_entries() + self.assertEqual(len(pr.invoices), 1) + self.assertEqual(len(pr.payments), 1) + invoices = [x.as_dict() for x in pr.invoices] + payments = [x.as_dict() for x in pr.payments] + pr.allocate_entries(frappe._dict({"invoices": invoices, "payments": payments})) + pr.reconcile() + self.assertEqual(len(pr.invoices), 0) + self.assertEqual(len(pr.payments), 0) + + # Outstanding in both currencies should be '0' + si.reload() + self.assertEqual(si.outstanding_amount, 0) + self.assert_ledger_outstanding(si.doctype, si.name, 0.0, 0.0) + + # Exchange Gain/Loss Journal should've been created. + exc_je_for_si = self.get_journals_for(si.doctype, si.name) + exc_je_for_pe = self.get_journals_for(pe.doctype, pe.name) + self.assertNotEqual(exc_je_for_si, []) + self.assertEqual(len(exc_je_for_si), 1) + self.assertEqual(len(exc_je_for_pe), 1) + self.assertEqual(exc_je_for_si[0], exc_je_for_pe[0]) + + self.assertEqual( + getdate(nowdate()), frappe.db.get_value("Journal Entry", exc_je_for_pe[0].parent, "posting_date") + ) + # Cancel Payment + pe.reload() + pe.cancel() + + # outstanding should be same as grand total + si.reload() + self.assertEqual(si.outstanding_amount, rate_in_account_currency) + self.assert_ledger_outstanding(si.doctype, si.name, rate, rate_in_account_currency) + + # Exchange Gain/Loss Journal should've been cancelled + exc_je_for_si = self.get_journals_for(si.doctype, si.name) + exc_je_for_pe = self.get_journals_for(pe.doctype, pe.name) + self.assertEqual(exc_je_for_si, []) + self.assertEqual(exc_je_for_pe, []) + def test_20_journal_against_sales_invoice(self): # Invoice in Foreign Currency si = self.create_sales_invoice(qty=1, conversion_rate=80, rate=1) From 1c10e4e92fbf6e2e8a34ed1a65ff57637bb8b7f9 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 23 Jan 2025 16:09:54 +0530 Subject: [PATCH 43/94] refactor: support JE posting date in semi-auto reconciilation tool (cherry picked from commit a71718883e933c7eadc15842cae2dd59c6b1d005) # Conflicts: # erpnext/accounts/doctype/process_payment_reconciliation_log_allocations/process_payment_reconciliation_log_allocations.json --- ...process_payment_reconciliation_log_allocations.json | 10 ++++++++++ .../process_payment_reconciliation_log_allocations.py | 1 + 2 files changed, 11 insertions(+) diff --git a/erpnext/accounts/doctype/process_payment_reconciliation_log_allocations/process_payment_reconciliation_log_allocations.json b/erpnext/accounts/doctype/process_payment_reconciliation_log_allocations/process_payment_reconciliation_log_allocations.json index b97d73886a9..5c771c54f52 100644 --- a/erpnext/accounts/doctype/process_payment_reconciliation_log_allocations/process_payment_reconciliation_log_allocations.json +++ b/erpnext/accounts/doctype/process_payment_reconciliation_log_allocations/process_payment_reconciliation_log_allocations.json @@ -20,6 +20,7 @@ "is_advance", "section_break_5", "difference_amount", + "gain_loss_posting_date", "column_break_7", "difference_account", "exchange_rate", @@ -153,11 +154,20 @@ "fieldtype": "Check", "in_list_view": 1, "label": "Reconciled" + }, + { + "fieldname": "gain_loss_posting_date", + "fieldtype": "Date", + "label": "Difference Posting Date" } ], "istable": 1, "links": [], +<<<<<<< HEAD "modified": "2023-03-20 21:05:43.121945", +======= + "modified": "2025-01-23 16:09:01.058574", +>>>>>>> a71718883e (refactor: support JE posting date in semi-auto reconciilation tool) "modified_by": "Administrator", "module": "Accounts", "name": "Process Payment Reconciliation Log Allocations", diff --git a/erpnext/accounts/doctype/process_payment_reconciliation_log_allocations/process_payment_reconciliation_log_allocations.py b/erpnext/accounts/doctype/process_payment_reconciliation_log_allocations/process_payment_reconciliation_log_allocations.py index da02e1a41e6..ca1785afdae 100644 --- a/erpnext/accounts/doctype/process_payment_reconciliation_log_allocations/process_payment_reconciliation_log_allocations.py +++ b/erpnext/accounts/doctype/process_payment_reconciliation_log_allocations/process_payment_reconciliation_log_allocations.py @@ -20,6 +20,7 @@ class ProcessPaymentReconciliationLogAllocations(Document): difference_account: DF.Link | None difference_amount: DF.Currency exchange_rate: DF.Float + gain_loss_posting_date: DF.Date | None invoice_number: DF.DynamicLink invoice_type: DF.Link is_advance: DF.Data | None From 2f60f235a8700390fb2abd7b1a7e84ce1c1c736c Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 24 Jan 2025 10:24:57 +0530 Subject: [PATCH 44/94] fix: decorator and merge conflicts --- .../process_payment_reconciliation_log_allocations.json | 6 +----- erpnext/controllers/tests/test_accounts_controller.py | 4 +--- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/erpnext/accounts/doctype/process_payment_reconciliation_log_allocations/process_payment_reconciliation_log_allocations.json b/erpnext/accounts/doctype/process_payment_reconciliation_log_allocations/process_payment_reconciliation_log_allocations.json index 5c771c54f52..9d20ca3a87d 100644 --- a/erpnext/accounts/doctype/process_payment_reconciliation_log_allocations/process_payment_reconciliation_log_allocations.json +++ b/erpnext/accounts/doctype/process_payment_reconciliation_log_allocations/process_payment_reconciliation_log_allocations.json @@ -163,11 +163,7 @@ ], "istable": 1, "links": [], -<<<<<<< HEAD - "modified": "2023-03-20 21:05:43.121945", -======= "modified": "2025-01-23 16:09:01.058574", ->>>>>>> a71718883e (refactor: support JE posting date in semi-auto reconciilation tool) "modified_by": "Administrator", "module": "Accounts", "name": "Process Payment Reconciliation Log Allocations", @@ -177,4 +173,4 @@ "sort_order": "DESC", "states": [], "track_changes": 1 -} \ No newline at end of file +} diff --git a/erpnext/controllers/tests/test_accounts_controller.py b/erpnext/controllers/tests/test_accounts_controller.py index 0c1049f0f0e..c45923b2fed 100644 --- a/erpnext/controllers/tests/test_accounts_controller.py +++ b/erpnext/controllers/tests/test_accounts_controller.py @@ -869,9 +869,7 @@ class TestAccountsController(FrappeTestCase): self.assertEqual(pi.items[0].rate, arms_length_price) self.assertEqual(pi.items[0].valuation_rate, 100) - @IntegrationTestCase.change_settings( - "Accounts Settings", {"exchange_gain_loss_posting_date": "Reconciliation Date"} - ) + @change_settings("Accounts Settings", {"exchange_gain_loss_posting_date": "Reconciliation Date"}) def test_17_gain_loss_posting_date_for_normal_payment(self): # Sales Invoice in Foreign Currency rate = 80 From de09da31bc56574dba539ffd45aabdd2904be7e6 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Fri, 24 Jan 2025 05:14:20 +0000 Subject: [PATCH 45/94] chore(release): Bumped to Version 15.49.3 ## [15.49.3](https://github.com/frappe/erpnext/compare/v15.49.2...v15.49.3) (2025-01-24) ### Bug Fixes * decorator and merge conflicts ([2f60f23](https://github.com/frappe/erpnext/commit/2f60f235a8700390fb2abd7b1a7e84ce1c1c736c)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index d6291128b25..561b8009e72 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.49.2" +__version__ = "15.49.3" def get_default_company(user=None): From c5cd0fcd29138ca5736fdde938a36e3528c9fda5 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 29 Jan 2025 11:28:47 +0000 Subject: [PATCH 46/94] chore(release): Bumped to Version 15.50.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # [15.50.0](https://github.com/frappe/erpnext/compare/v15.49.3...v15.50.0) (2025-01-29) ### Bug Fixes * add condition to check if item is delivered by supplier in make_purchase_order_for_default_supplier() (backport [#45370](https://github.com/frappe/erpnext/issues/45370)) ([#45410](https://github.com/frappe/erpnext/issues/45410)) ([5d7d3d8](https://github.com/frappe/erpnext/commit/5d7d3d8c19ca79480dfdf42dbe510476d0a7f821)) * add multiple item issue in stock entry (backport [#45544](https://github.com/frappe/erpnext/issues/45544)) ([#45580](https://github.com/frappe/erpnext/issues/45580)) ([8b0efab](https://github.com/frappe/erpnext/commit/8b0efab13ede54d8b5ffd9451108c77f09aff269)) * added debounce to prevent multiple clicks (backport [#45369](https://github.com/frappe/erpnext/issues/45369)) ([#45376](https://github.com/frappe/erpnext/issues/45376)) ([bdc65da](https://github.com/frappe/erpnext/commit/bdc65daaddf38d24a7c6860edf4b3b9390a26e45)) * added item_group filter in item_code field in stock balance report (backport [#45340](https://github.com/frappe/erpnext/issues/45340)) ([#45389](https://github.com/frappe/erpnext/issues/45389)) ([412e22f](https://github.com/frappe/erpnext/commit/412e22fb4e6c0c6a61af4d568d26d50880541b5c)) * allow to fix negative stock for batch using stock reco ([69c5695](https://github.com/frappe/erpnext/commit/69c5695f6efce54776a7d2e6af11aef54ca595af)) * batch qty calculation (backport [#45367](https://github.com/frappe/erpnext/issues/45367)) ([#45388](https://github.com/frappe/erpnext/issues/45388)) ([767529f](https://github.com/frappe/erpnext/commit/767529f0ec4d982e2eaba40de00b39234c400fda)) * Correct Party Bank Account mapping in `Payment Entry` ([4a390ae](https://github.com/frappe/erpnext/commit/4a390ae3de91f4f7c8d7e5a76eee2a804d0b59c6)) * currency decimal on POS Past Order List (backport [#45524](https://github.com/frappe/erpnext/issues/45524)) ([#45527](https://github.com/frappe/erpnext/issues/45527)) ([ff46ae5](https://github.com/frappe/erpnext/commit/ff46ae5bc1af5c28aaafe9213ac6795e0d0d8892)) * disable load_after_mapping when purchase order created from sales order (backport [#45405](https://github.com/frappe/erpnext/issues/45405)) ([#45429](https://github.com/frappe/erpnext/issues/45429)) ([ae5ce97](https://github.com/frappe/erpnext/commit/ae5ce97fd0c18e374cdc970e58c57c3c213faa9a)) * Do no query GLs if no PCVs are posted ([ad06652](https://github.com/frappe/erpnext/commit/ad06652ed5fd28737df459be4a152b3aff89f230)) * do not allow to manually submit the SABB ([2b16eb5](https://github.com/frappe/erpnext/commit/2b16eb53810b3a0944ae02cbec80913f036ef16a)) * do not check budget during reposting ([#45432](https://github.com/frappe/erpnext/issues/45432)) ([f2b946d](https://github.com/frappe/erpnext/commit/f2b946d3250120b1c00557bca54ca199389def53)) * don't update party-type on change of cost center in Journal Entry ([#45291](https://github.com/frappe/erpnext/issues/45291)) ([fb75180](https://github.com/frappe/erpnext/commit/fb75180a7da1795ea81ed4b73fe8b467b79aa439)) * existing logical error ([6c4655d](https://github.com/frappe/erpnext/commit/6c4655dd72dc304d07b2b23a26e7f61eb1ff00b9)) * fix creating documents from sales invoice (backport [#45346](https://github.com/frappe/erpnext/issues/45346)) ([#45408](https://github.com/frappe/erpnext/issues/45408)) ([73a21c2](https://github.com/frappe/erpnext/commit/73a21c294c6917ca59232fc5671e32c5f16aaceb)) * get stock balance filtered by company for validating stock value in jv (backport [#45549](https://github.com/frappe/erpnext/issues/45549)) ([#45578](https://github.com/frappe/erpnext/issues/45578)) ([ef2f411](https://github.com/frappe/erpnext/commit/ef2f4118d953276a8a33b7dc545ff9d89ed86548)) * import ([d74c498](https://github.com/frappe/erpnext/commit/d74c498efecbe3ff80d20782192f046be68c36d5)) * import 2 ([b59d253](https://github.com/frappe/erpnext/commit/b59d253d93fa521994c22c81600e7e7e9c8ee6ff)) * JobCardTimeLog' object has no attribute 'remaining_time_in_mins' ([ef15429](https://github.com/frappe/erpnext/commit/ef15429d98a615d745542b485ee010797a1c800c)) * logical error in where condition of qb query ([c102e51](https://github.com/frappe/erpnext/commit/c102e51eb18748b60f5793b23bd6dfd35b66835b)) * **material request:** mapping Sales Order Item Delivery Date to Mate… (backport [#45227](https://github.com/frappe/erpnext/issues/45227)) ([#45424](https://github.com/frappe/erpnext/issues/45424)) ([52fdc7c](https://github.com/frappe/erpnext/commit/52fdc7cecd96aa9fc74d33240fccb3cb7580b03a)) * merge conflict ([57f79a2](https://github.com/frappe/erpnext/commit/57f79a22401ec1ffadb8ae4a7dddea5236e213db)) * **payment entry:** get amount in transaction currency ([b37602c](https://github.com/frappe/erpnext/commit/b37602c716b6bad3ae3485f5a578e7c0a0e78c38)) * postal_code_move_and_fixes ([0e088dd](https://github.com/frappe/erpnext/commit/0e088dde36b2ccb2fdd17b2e2f5a76ca9f9170a1)) * precision issue causing incorrect status ([46a2b7a](https://github.com/frappe/erpnext/commit/46a2b7a07e5326ad5fde89d030460a5e9f2b67b0)) * precision issue in stock entry ([fe5e42d](https://github.com/frappe/erpnext/commit/fe5e42d2dc9a3570635bb75876ea8172862dae60)) * **query:** remove duplicate docstatus condition ([#45586](https://github.com/frappe/erpnext/issues/45586)) ([2d2f30e](https://github.com/frappe/erpnext/commit/2d2f30e6cf4aacabe46f827f66dd67f0e6dfd1b6)) * remove applied pricing rule ([4e347d8](https://github.com/frappe/erpnext/commit/4e347d835e86c644dfd2a0a6b955f0b4aa8e4713)) * remove unnecessary auth from plaid connector (backport [#44305](https://github.com/frappe/erpnext/issues/44305)) ([#45421](https://github.com/frappe/erpnext/issues/45421)) ([d9b342f](https://github.com/frappe/erpnext/commit/d9b342f2579fbca48070b99c9b1b91fa197a2c28)) * removed field not present in v15 ([1be1981](https://github.com/frappe/erpnext/commit/1be19819fbc79482004e53c15567ef3ae38b4966)) * resolved pos return setting to default mode of payment instead of user selection (backport [#45377](https://github.com/frappe/erpnext/issues/45377)) ([#45419](https://github.com/frappe/erpnext/issues/45419)) ([224a925](https://github.com/frappe/erpnext/commit/224a92587d3bb74a05e5d1e66f3657b46d979f5a)) * return qty error due to precision (backport [#45536](https://github.com/frappe/erpnext/issues/45536)) ([#45581](https://github.com/frappe/erpnext/issues/45581)) ([a2ffdc7](https://github.com/frappe/erpnext/commit/a2ffdc78054d70c2daa7f8d00a712b8a328002c2)) * secure bulk transaction (backport [#45386](https://github.com/frappe/erpnext/issues/45386)) ([#45426](https://github.com/frappe/erpnext/issues/45426)) ([f9d9672](https://github.com/frappe/erpnext/commit/f9d96726f06fe246f84e4ea7647e2e0eec733240)) * set company related values ([1498275](https://github.com/frappe/erpnext/commit/149827562be1957a28cf13d303fed1d0362f41b1)) * set expense_account and cost_center based on company in stock entry (backport [#45159](https://github.com/frappe/erpnext/issues/45159)) ([#45416](https://github.com/frappe/erpnext/issues/45416)) ([3eb28bb](https://github.com/frappe/erpnext/commit/3eb28bb0e094063405d718f1cd91ab719bd22f60)) * set party_account_currency for pos_invoice returns ([172fdad](https://github.com/frappe/erpnext/commit/172fdad24457fca4c5cec4a64e125213db4ff7db)) * set preferred email in Employee via backend controller (backport [#45320](https://github.com/frappe/erpnext/issues/45320)) ([#45379](https://github.com/frappe/erpnext/issues/45379)) ([f8099a6](https://github.com/frappe/erpnext/commit/f8099a6847f2b08423401a9e2da35e578f178891)) * Set right party name in bank transaction ([86f4bf6](https://github.com/frappe/erpnext/commit/86f4bf6e0166f3049a21d5b23765aab82e562cbb)) * show payment entries in Tax Withheld Vouchers ([28bb9c3](https://github.com/frappe/erpnext/commit/28bb9c39e823560426cb8a727da03409ea9e7146)) * System was allowing to save payment schedule amount less than grand total (backport [#45322](https://github.com/frappe/erpnext/issues/45322)) ([#45381](https://github.com/frappe/erpnext/issues/45381)) ([2403cdc](https://github.com/frappe/erpnext/commit/2403cdc4d7ed51f48452197942742020b688cc00)) * update fields on change of item code In `Update Items` of `Sales Order` ([#45125](https://github.com/frappe/erpnext/issues/45125)) ([f60a3bc](https://github.com/frappe/erpnext/commit/f60a3bcedfe48d84a9773f504a99cd50c83a0b76)) * update voucher outstanding from payment ledger ([e385594](https://github.com/frappe/erpnext/commit/e3855949e14d445fe6becfd2dae91fff9309ba42)) * Use `process.extract` to get the corresponding party doc name of the result ([153e961](https://github.com/frappe/erpnext/commit/153e961df75a9766512c1b9fc70c502be0df6986)) * use frappe.datetime.str_to_user (backport [#45216](https://github.com/frappe/erpnext/issues/45216)) ([#45417](https://github.com/frappe/erpnext/issues/45417)) ([6c10393](https://github.com/frappe/erpnext/commit/6c1039316403b0095d96a64c3d53009fb358242a)) * use user defined discount amount or default ([e73aab0](https://github.com/frappe/erpnext/commit/e73aab0df548916551750c4371f18770b0c7c204)) * validate items against selling settings (backport [#45288](https://github.com/frappe/erpnext/issues/45288)) ([#45431](https://github.com/frappe/erpnext/issues/45431)) ([7ff7ec7](https://github.com/frappe/erpnext/commit/7ff7ec792928ed3a76eda8c62adb2d121e4ff4de)) * validate non-stock item for exchange loss/gain (backport [#45306](https://github.com/frappe/erpnext/issues/45306)) ([#45380](https://github.com/frappe/erpnext/issues/45380)) ([4e367de](https://github.com/frappe/erpnext/commit/4e367dedec0babd38072338d084beb0d14906976)) * valuation for batch (backport [#45335](https://github.com/frappe/erpnext/issues/45335)) ([#45420](https://github.com/frappe/erpnext/issues/45420)) ([dec0cae](https://github.com/frappe/erpnext/commit/dec0caeac56453a63fbc8e24f76e33e1fec56eb6)) * variable names ([8f73978](https://github.com/frappe/erpnext/commit/8f73978a26c05357bd596db61d93013a4d9dfc63)) * Wrong `bank_ac_no` filter + simplify convoluted logic ([60feb7c](https://github.com/frappe/erpnext/commit/60feb7cbd42090235bb3f1ad61aa86eeddcc97eb)) ### Features * Add chart of accounts for Switzerland ([de43c12](https://github.com/frappe/erpnext/commit/de43c123e206085545b4c075882b6839c225962e)) * add company level validation for accounting dimension ([8f0d270](https://github.com/frappe/erpnext/commit/8f0d270746f1137cf464ea3ec53eee3aa5835cb1)) * Add corrective job card operating cost as additional costs in stock entry ([efc7b9a](https://github.com/frappe/erpnext/commit/efc7b9ac56545d236d3069a8911acd1216036b96)) * full screen on pos (backport [#45404](https://github.com/frappe/erpnext/issues/45404)) ([#45418](https://github.com/frappe/erpnext/issues/45418)) ([aca8d66](https://github.com/frappe/erpnext/commit/aca8d663dd98c9ad5d377afcd9f62c8b0b324144)) * pos configuration for print receipt on complete order ([#45392](https://github.com/frappe/erpnext/issues/45392)) ([b9b4f63](https://github.com/frappe/erpnext/commit/b9b4f6316d5a75c764b8b02aa75dcabba8450051)) * **Sales Invoice:** allow linking to project without adding timesheets (backport [#44295](https://github.com/frappe/erpnext/issues/44295)) ([#45528](https://github.com/frappe/erpnext/issues/45528)) ([2c2a25a](https://github.com/frappe/erpnext/commit/2c2a25ab16f5b53ddf17dc23abff6e9ab14f1e4d)) * **translations:** add Bengali translations for signature and client details ([4952733](https://github.com/frappe/erpnext/commit/495273365be3bd3085a3384ce5e00f913711e8f4)) * **UX:** scroll to required field (backport [#44367](https://github.com/frappe/erpnext/issues/44367)) ([#45433](https://github.com/frappe/erpnext/issues/45433)) ([692a448](https://github.com/frappe/erpnext/commit/692a44816f698d80239d2d97cb06d073547dc045)) ### Performance Improvements * optimize DB calls with frappe.get_all (backport [#45289](https://github.com/frappe/erpnext/issues/45289)) ([#45391](https://github.com/frappe/erpnext/issues/45391)) ([04f5a72](https://github.com/frappe/erpnext/commit/04f5a72e0847f66da120e0f81fd2aefc7eac94cf)) ### Reverts * Revert "feat(Sales Invoice): allow linking to project without adding timesheets (backport [#44295](https://github.com/frappe/erpnext/issues/44295))" ([#45531](https://github.com/frappe/erpnext/issues/45531)) ([b004855](https://github.com/frappe/erpnext/commit/b004855e7cfe522cf138f803ca46840f5f018b60)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 561b8009e72..dfdeee49bc9 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.49.3" +__version__ = "15.50.0" def get_default_company(user=None): From 32bfc2f5553661c2ba46109e6b22bdbea963a108 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Fri, 31 Jan 2025 23:04:54 +0530 Subject: [PATCH 47/94] fix: not able to make manufacturing entry for alternate items (cherry picked from commit 1607aa1a448ab5f6c19ded84d52319b2b86a57b0) (cherry picked from commit eef2f3c5d4861c1e77248581549a3ca95d2b5b56) --- .../doctype/work_order/test_work_order.py | 53 +++++++++++++++++++ .../stock/doctype/stock_entry/stock_entry.py | 7 ++- 2 files changed, 58 insertions(+), 2 deletions(-) diff --git a/erpnext/manufacturing/doctype/work_order/test_work_order.py b/erpnext/manufacturing/doctype/work_order/test_work_order.py index f94e4a56c7c..205ca1dbdb4 100644 --- a/erpnext/manufacturing/doctype/work_order/test_work_order.py +++ b/erpnext/manufacturing/doctype/work_order/test_work_order.py @@ -2367,6 +2367,59 @@ class TestWorkOrder(FrappeTestCase): stock_entry.submit() + def test_components_alternate_item_for_bom_based_manufacture_entry(self): + frappe.db.set_single_value("Manufacturing Settings", "backflush_raw_materials_based_on", "BOM") + frappe.db.set_single_value("Manufacturing Settings", "validate_components_quantities_per_bom", 1) + + fg_item = "Test FG Item For Component Validation for alternate item" + source_warehouse = "Stores - _TC" + raw_materials = ["Test Component Validation RM Item 112", "Test Component Validation RM Item 22"] + alternate_item = ["Alternate Test Component Validation RM Item 1"] + + make_item(fg_item, {"is_stock_item": 1}) + for item in raw_materials + alternate_item: + make_item(item, {"is_stock_item": 1, "allow_alternative_item": 1}) + test_stock_entry.make_stock_entry( + item_code=item, + target=source_warehouse, + qty=10, + basic_rate=100, + ) + + frappe.get_doc( + { + "doctype": "Item Alternative", + "item_code": raw_materials[0], + "alternative_item_code": alternate_item[0], + "two_way": 1, + } + ).insert() + + make_bom(item=fg_item, source_warehouse=source_warehouse, raw_materials=raw_materials) + + wo = make_wo_order_test_record( + item=fg_item, + qty=10, + source_warehouse=source_warehouse, + ) + + transfer_entry = frappe.get_doc(make_stock_entry(wo.name, "Material Transfer for Manufacture", 10)) + transfer_entry.save() + transfer_entry.items[0].item_code = alternate_item[0] + transfer_entry.items[0].original_item = raw_materials[0] + transfer_entry.submit() + + self.assertTrue(transfer_entry.docstatus == 1) + + manufacture_entry = frappe.get_doc(make_stock_entry(wo.name, "Manufacture", 10)) + manufacture_entry.save() + self.assertTrue(manufacture_entry.items[0].item_code == alternate_item[0]) + self.assertTrue(manufacture_entry.items[0].original_item == raw_materials[0]) + + manufacture_entry.submit() + + frappe.db.set_single_value("Manufacturing Settings", "validate_components_quantities_per_bom", 0) + def test_components_qty_for_bom_based_manufacture_entry(self): frappe.db.set_single_value("Manufacturing Settings", "backflush_raw_materials_based_on", "BOM") frappe.db.set_single_value("Manufacturing Settings", "validate_components_quantities_per_bom", 1) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index eec30f69f36..95d6d7079b7 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -749,7 +749,7 @@ class StockEntry(StockController): def get_matched_items(self, item_code): for row in self.items: - if row.item_code == item_code: + if row.item_code == item_code or row.original_item == item_code: return row return {} @@ -1839,7 +1839,7 @@ class StockEntry(StockController): item_wh = frappe._dict(item_wh) - for item in item_dict.values(): + for original_item, item in item_dict.items(): if self.pro_doc and cint(self.pro_doc.from_wip_warehouse): item["from_warehouse"] = self.pro_doc.wip_warehouse # Get Reserve Warehouse from Subcontract Order @@ -1852,6 +1852,9 @@ class StockEntry(StockController): self.to_warehouse if self.purpose == "Send to Subcontractor" else "" ) + if original_item != item.get("item_code"): + item["original_item"] = original_item + self.add_to_stock_entry_detail(item_dict) # fetch the serial_no of the first stock entry for the second stock entry From fea51b708607a78a744f7ce851b2a460e90dcf55 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Tue, 4 Feb 2025 10:23:41 +0000 Subject: [PATCH 48/94] chore(release): Bumped to Version 15.50.1 ## [15.50.1](https://github.com/frappe/erpnext/compare/v15.50.0...v15.50.1) (2025-02-04) ### Bug Fixes * not able to make manufacturing entry for alternate items ([32bfc2f](https://github.com/frappe/erpnext/commit/32bfc2f5553661c2ba46109e6b22bdbea963a108)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index dfdeee49bc9..18b66e88a64 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.50.0" +__version__ = "15.50.1" def get_default_company(user=None): From b1161f446fe95c55e99c0d1d9d00f741c1eec8ce Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 5 Feb 2025 12:08:00 +0000 Subject: [PATCH 49/94] chore(release): Bumped to Version 15.51.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # [15.51.0](https://github.com/frappe/erpnext/compare/v15.50.1...v15.51.0) (2025-02-05) ### Bug Fixes * actual qty showing blank for sub-assembly items ([d0748b1](https://github.com/frappe/erpnext/commit/d0748b1b675eee2c83f230983219e3d2ddf45606)) * added correct options for incoming_rate field of delivery note item ([cfc5007](https://github.com/frappe/erpnext/commit/cfc50073edcd8c15421d8231328eb9dc045bd7ba)) * allow multiple email ids ([2a25302](https://github.com/frappe/erpnext/commit/2a25302c35a6baaa8aa0febe1b6c58a7247cb8b5)) * attribute 'msgbox' not found in sales invoice.js ([f6b4984](https://github.com/frappe/erpnext/commit/f6b49845e29c7edf31cf06140dfa09e54650b958)) * bind this to function ([c0b32c4](https://github.com/frappe/erpnext/commit/c0b32c446bd1dd94302d12787977bbec8781ec48)) * check billing address ([44d9fb7](https://github.com/frappe/erpnext/commit/44d9fb7a699805eb40272352de49c66ea6bda859)) * closing stock balance report not generating ([47d1c3b](https://github.com/frappe/erpnext/commit/47d1c3b5a386f8abf464460522f07754a26d4948)) * conflicts ([4aa072a](https://github.com/frappe/erpnext/commit/4aa072a8eb754209d0ce42d71f3e19c5f8c7cbf5)) * consider process_loss_qty in work order ([1522d76](https://github.com/frappe/erpnext/commit/1522d76a3b7e9ae006369f42d676cad74d14d798)) * copy correct uom from devliery note when creating packing list ([f9794e5](https://github.com/frappe/erpnext/commit/f9794e5b446b9a851a16376c14b7b02c59bc99fb)) * correct error message in payment entry ([6ea5307](https://github.com/frappe/erpnext/commit/6ea5307b0eb02a2c9c7e37d598a032f2f10998b4)) * default payment terms template selected while duplicating ([ca4bb96](https://github.com/frappe/erpnext/commit/ca4bb96fb4182d784444ee704679550ec6368806)) * Do not check for cancelled invoices ([84638f5](https://github.com/frappe/erpnext/commit/84638f58fd238e8ec420497b4f092e3904d5b729)) * Do not check for cancelled invoices ([b612ab5](https://github.com/frappe/erpnext/commit/b612ab582326e86f7e61f6034ff597d44d39d829)) * fetch rate from item price list when document is saved ([b140ce7](https://github.com/frappe/erpnext/commit/b140ce71d75fdc6c24664c2ec68a693a63e9d0f8)) * filter the item tax template using the input text ([8ea9a9e](https://github.com/frappe/erpnext/commit/8ea9a9e4678c3fc145d3a7afad98dd89d05c985b)) * Gross Profit Report with Correct Totals and Gross Margin (backport [#45548](https://github.com/frappe/erpnext/issues/45548)) ([#45598](https://github.com/frappe/erpnext/issues/45598)) ([6301b32](https://github.com/frappe/erpnext/commit/6301b321d894db91df3efb51b6cb8f52d7eafb04)) * handling company in bank reconciliation tool ([#45582](https://github.com/frappe/erpnext/issues/45582)) ([aa27e19](https://github.com/frappe/erpnext/commit/aa27e19a58bce878b4b34a74bd679bfebbd6b236)) * ignore expired batch for pick list ([786db3d](https://github.com/frappe/erpnext/commit/786db3d0fae6daf010554566e0ceb352b68747a8)) * loading print receipt only at order complete (backport [#45627](https://github.com/frappe/erpnext/issues/45627)) ([#45628](https://github.com/frappe/erpnext/issues/45628)) ([72868ee](https://github.com/frappe/erpnext/commit/72868eee04feecdf2847fcc32e8b00a459ec7d1d)) * logical error failing tests ([6a03f99](https://github.com/frappe/erpnext/commit/6a03f995463d76e95c09543160addc9ea8b26283)) * not able to make manufacturing entry for alternate items ([eef2f3c](https://github.com/frappe/erpnext/commit/eef2f3c5d4861c1e77248581549a3ca95d2b5b56)) * only system manager was able to create customer & prospect ([6149306](https://github.com/frappe/erpnext/commit/6149306b7887ecba2f1e1184408905a2b0612481)) * payment schedule table is empty while duplicating record ([c523625](https://github.com/frappe/erpnext/commit/c52362531cb4209ed14b77bb64bbb675111c666f)) * point of sale padding (backport [#45697](https://github.com/frappe/erpnext/issues/45697)) ([#45699](https://github.com/frappe/erpnext/issues/45699)) ([b915e7f](https://github.com/frappe/erpnext/commit/b915e7f63726daf219055a754114237264987c8e)) * pos payment cash shortcut decimal (backport [#45702](https://github.com/frappe/erpnext/issues/45702)) ([#45705](https://github.com/frappe/erpnext/issues/45705)) ([6113cc1](https://github.com/frappe/erpnext/commit/6113cc1e43ea15d76b22b59996636b3cbaffb963)) * pos print receipt on submit (backport [#45632](https://github.com/frappe/erpnext/issues/45632)) ([#45633](https://github.com/frappe/erpnext/issues/45633)) ([676dde5](https://github.com/frappe/erpnext/commit/676dde59c2e79ba12433448b1a0bd54626ed437a)) * **pos:** add item in the existing item row when discount is applied ([0b54cb9](https://github.com/frappe/erpnext/commit/0b54cb9a7cb15bab8368993d7fccf302689d990a)) * posting_date to posting_datetime in stock related queries ([cd5174e](https://github.com/frappe/erpnext/commit/cd5174e42343a1a271fbae791b4d7a5a7f15330e)) * remove tds account in taxes table on change of Tax Withholding Category ([1ad16c3](https://github.com/frappe/erpnext/commit/1ad16c368e552f8a39ca19eec31c8847dbc10b2c)) * removed unused field ([9a27d3c](https://github.com/frappe/erpnext/commit/9a27d3cedccc17dee1bc67de5db020adc7058660)) * renamed Commments Tab to Notes tab in Lead doctype ([86edcfc](https://github.com/frappe/erpnext/commit/86edcfc1fdc03f71898acec0ff48f2522586ca4a)) * reposting issue with s3 backup ([73c1bf9](https://github.com/frappe/erpnext/commit/73c1bf972efa27229aae70c37ae5cf44c22444f1)) * resolved conflicts ([223fe62](https://github.com/frappe/erpnext/commit/223fe626380173386aeba1a43d573d46fa173d8c)) * respect user set account if not advance account for getting outstanding invoices in payment entry ([8108d7f](https://github.com/frappe/erpnext/commit/8108d7fdba96dfcef6f3c6252fbd8a4ac60794d0)) * semgrep ([401fd7f](https://github.com/frappe/erpnext/commit/401fd7fca7966bc2719ab0174b50d238f0b6d5ae)) * set asset value correctly after cancelling value adjustment ([7f7f403](https://github.com/frappe/erpnext/commit/7f7f403f5b293251cb940017eb46d88b57daba42)) * show only items with inspection enabled on create QI dialog ([34f8a37](https://github.com/frappe/erpnext/commit/34f8a370d1deff8a8b20ca5b019c84e366850665)) * slow SABB query ([7931c2d](https://github.com/frappe/erpnext/commit/7931c2d182984089f25f3348bb4ba9e075354b69)) * subcontracting valiation precision issue ([5319683](https://github.com/frappe/erpnext/commit/5319683dbf2ec2e9fb4727cf6e9dd90767f06252)) * track employee changes ([#45674](https://github.com/frappe/erpnext/issues/45674)) ([cf98ebf](https://github.com/frappe/erpnext/commit/cf98ebf7fe9989d9042db64ccfde47c91f156dd9)) * validation message ([4742211](https://github.com/frappe/erpnext/commit/47422111b4fcbca792665e0a3d722e00e3d3cf49)) * validation to prevent submission if the SABB is not linked to a stock transaction ([24a6f61](https://github.com/frappe/erpnext/commit/24a6f611d86b4406fda5ad14de331e4ddf6dc379)) ### Features * account heads changed along with journal entry type and descrip… ([#42845](https://github.com/frappe/erpnext/issues/42845)) ([bbecd36](https://github.com/frappe/erpnext/commit/bbecd36a5dd65bb138c9f8b2528abd92cf886745)) * report to find incorrect SABB ([a948f2e](https://github.com/frappe/erpnext/commit/a948f2e095a7fc859f66d382767572edffebfaea)) * set bank account of company to default company bank account from masters ([b840271](https://github.com/frappe/erpnext/commit/b840271d2a643eeeee514fe0e237f6d7b46935ef)) ### Performance Improvements * stock entry with batch (backport [#45486](https://github.com/frappe/erpnext/issues/45486)) ([#45602](https://github.com/frappe/erpnext/issues/45602)) ([8b75401](https://github.com/frappe/erpnext/commit/8b75401db9bd58049c817964771874b7909e6efa)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 18b66e88a64..ba69d17b797 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.50.1" +__version__ = "15.51.0" def get_default_company(user=None): From 13bebe71b0bcbdc7968433d070825c58136d6be1 Mon Sep 17 00:00:00 2001 From: Sanket322 Date: Thu, 6 Feb 2025 17:55:37 +0530 Subject: [PATCH 50/94] fix: update ctx to args (cherry picked from commit d4bc3d182fb7bb4409fcca949b7ff338984496f7) --- erpnext/public/js/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js index a000cdee7cc..cd851b57972 100755 --- a/erpnext/public/js/utils.js +++ b/erpnext/public/js/utils.js @@ -661,7 +661,7 @@ erpnext.utils.update_child_items = function (opts) { method: "erpnext.stock.get_item_details.get_item_details", args: { doc: frm.doc, - ctx: { + args: { item_code: this.value, set_warehouse: frm.doc.set_warehouse, customer: frm.doc.customer || frm.doc.party_name, From 8c57e9f8c8c74a5d21893ea01d4e244d0401e8ab Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Fri, 7 Feb 2025 14:22:13 +0000 Subject: [PATCH 51/94] chore(release): Bumped to Version 15.51.1 ## [15.51.1](https://github.com/frappe/erpnext/compare/v15.51.0...v15.51.1) (2025-02-07) ### Bug Fixes * update ctx to args ([13bebe7](https://github.com/frappe/erpnext/commit/13bebe71b0bcbdc7968433d070825c58136d6be1)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index ba69d17b797..a86ae74237c 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.51.0" +__version__ = "15.51.1" def get_default_company(user=None): From e8fd2eeaa2e776dc14aa060d8109645f4cc7fd46 Mon Sep 17 00:00:00 2001 From: DaizyModi Date: Thu, 6 Feb 2025 21:54:57 +0530 Subject: [PATCH 52/94] fix: Attibute error `selling_price_list` (cherry picked from commit 820b32eb8ab0aa145e008cd42e7ded376e61568c) (cherry picked from commit 6dc99f95c01f955acc132b816c5eaa91b4c535af) --- erpnext/stock/get_item_details.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index e565b5c6015..291aa370056 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -207,7 +207,7 @@ def update_stock(ctx, out, doc=None): for batch_no, batch_qty in batches.items(): rate = get_batch_based_item_price( - {"price_list": doc.selling_price_list, "uom": out.uom, "batch_no": batch_no}, + {"price_list": doc.get("selling_price_list"), "uom": out.uom, "batch_no": batch_no}, out.item_code, ) if batch_qty >= qty: From d0dbfa1cbd39fc028c78a56758f89201101faf8e Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Mon, 10 Feb 2025 19:09:02 +0530 Subject: [PATCH 53/94] fix: check_item_quality_inspection is not whitelisted (cherry picked from commit 0a4a09352aebade2a3f7be0c25210a947bf0268c) --- erpnext/controllers/stock_controller.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py index fd92fe104cc..a8f9976c83b 100644 --- a/erpnext/controllers/stock_controller.py +++ b/erpnext/controllers/stock_controller.py @@ -1564,6 +1564,7 @@ def repost_required_for_queue(doc: StockController) -> bool: return False +@frappe.whitelist() def check_item_quality_inspection(doctype, items): if isinstance(items, str): items = json.loads(items) From b0c9fbe9fc861659fac5f65d0cc8cfdfd3a537a3 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Mon, 10 Feb 2025 16:28:24 +0000 Subject: [PATCH 54/94] chore(release): Bumped to Version 15.51.2 ## [15.51.2](https://github.com/frappe/erpnext/compare/v15.51.1...v15.51.2) (2025-02-10) ### Bug Fixes * Attibute error `selling_price_list` ([e8fd2ee](https://github.com/frappe/erpnext/commit/e8fd2eeaa2e776dc14aa060d8109645f4cc7fd46)) * check_item_quality_inspection is not whitelisted ([d0dbfa1](https://github.com/frappe/erpnext/commit/d0dbfa1cbd39fc028c78a56758f89201101faf8e)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index a86ae74237c..6542e611c1e 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.51.1" +__version__ = "15.51.2" def get_default_company(user=None): From ce90d427e82d6e4a30b08a2f6158a20ad067615b Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 12 Feb 2025 12:09:09 +0000 Subject: [PATCH 55/94] chore(release): Bumped to Version 15.52.0 # [15.52.0](https://github.com/frappe/erpnext/compare/v15.51.2...v15.52.0) (2025-02-12) ### Bug Fixes * '0' rate LDC's Invoice net totals should be ignored ([96c19cd](https://github.com/frappe/erpnext/commit/96c19cd9902b0de61b6582435fc4a1bd552b4867)) * add allow_on_submit for party_balance, paid_from_account_balance and paid_to_account_balance ([086c36f](https://github.com/frappe/erpnext/commit/086c36fca6e0db5abc097f82c443b843048adc8f)) * add precision in serial_batch_bundle.py ([a85f6f5](https://github.com/frappe/erpnext/commit/a85f6f54fe5340877c1aad06afb323420807fe08)) * add total row in non_grouped_invoices ([e432ae9](https://github.com/frappe/erpnext/commit/e432ae98a94c7f44470d26f207ff3a2feda45a49)) * added validation for required invoice_fields in POS (backport [#45780](https://github.com/frappe/erpnext/issues/45780)) ([#45868](https://github.com/frappe/erpnext/issues/45868)) ([4f9a7f5](https://github.com/frappe/erpnext/commit/4f9a7f50653109c547b4465a9bf867d11e15bf9c)) * Attibute error `selling_price_list` ([6dc99f9](https://github.com/frappe/erpnext/commit/6dc99f95c01f955acc132b816c5eaa91b4c535af)) * changed naming series to random for SABB ([48a4eff](https://github.com/frappe/erpnext/commit/48a4effdb65b016b9d0eb8066758c9577fcb0d8c)) * check_item_quality_inspection is not whitelisted ([0a4a093](https://github.com/frappe/erpnext/commit/0a4a09352aebade2a3f7be0c25210a947bf0268c)) * correct amount in transaction currency for reverse gl entries (backport [#45794](https://github.com/frappe/erpnext/issues/45794)) ([#45849](https://github.com/frappe/erpnext/issues/45849)) ([b06bd82](https://github.com/frappe/erpnext/commit/b06bd825c19a5d1c1aeb3ade1a5dda65a7f2286f)) * correct amt in account currency for lcv with manually distributed charges. (backport [#45532](https://github.com/frappe/erpnext/issues/45532)) ([#45864](https://github.com/frappe/erpnext/issues/45864)) ([179cb1e](https://github.com/frappe/erpnext/commit/179cb1e6e589b9d1e60dda5243e7f5a284e9fd86)) * correct pay amount in portal pages ([3ada520](https://github.com/frappe/erpnext/commit/3ada5206189a0c9b9b4ea667515503391a284fce)) * create job card with wip warehouse set to source warehouse if material transfer to wip warehouse is skipped in work order ([9d6f318](https://github.com/frappe/erpnext/commit/9d6f3180d4313b4363ff83312c06091782bedc1c)) * do not allow "Finance Book" in Accounting Dimensions (backport [#45696](https://github.com/frappe/erpnext/issues/45696)) ([#45856](https://github.com/frappe/erpnext/issues/45856)) ([0954aca](https://github.com/frappe/erpnext/commit/0954aca758e73ebb9f6bc078139497377e4b4954)) * do not validate party against Receivable and Payable account for cancelled gl entries ([6d777cd](https://github.com/frappe/erpnext/commit/6d777cdc68e21836355245c86148767add7f495b)) * dont update rate of free item on save ([1d3da4d](https://github.com/frappe/erpnext/commit/1d3da4d49a921c40072c980c016964cdccbfef41)) * handle response when json is None ([eeb322b](https://github.com/frappe/erpnext/commit/eeb322bd0e837e66d57365d5fe1669e0c9a47579)) * map project from rfq to supplier quotation (backport [#45745](https://github.com/frappe/erpnext/issues/45745)) ([#45828](https://github.com/frappe/erpnext/issues/45828)) ([b112d88](https://github.com/frappe/erpnext/commit/b112d88767a3cd98a8c9a3a2804d3f491c4c7d4a)) * not able to select the item in the sales invoice ([a649001](https://github.com/frappe/erpnext/commit/a649001886c57846d2053ebf0124e79144265a0f)) * Party name in Supplier Portal for Purchase Order (backport [#45772](https://github.com/frappe/erpnext/issues/45772)) ([#45858](https://github.com/frappe/erpnext/issues/45858)) ([435c354](https://github.com/frappe/erpnext/commit/435c35414fab3f259c8f1a1709037bf35dbe4056)) * pos numpad editable action buttons (backport [#45823](https://github.com/frappe/erpnext/issues/45823)) ([#45826](https://github.com/frappe/erpnext/issues/45826)) ([035758f](https://github.com/frappe/erpnext/commit/035758f47dcaa10e7484909eb252cf4cbb333fe6)) * possible model sync issue ([ea01fa1](https://github.com/frappe/erpnext/commit/ea01fa135ee2ef0a467a97ba6dfb804926333f85)) * **regional:** removed payment schedule validation in sales invoice for italy (backport [#45852](https://github.com/frappe/erpnext/issues/45852)) ([#45854](https://github.com/frappe/erpnext/issues/45854)) ([2e9e355](https://github.com/frappe/erpnext/commit/2e9e355329cd69b5822d4ffa9dc5aae395e07513)) * remove serial no if qty is zero ([1359a77](https://github.com/frappe/erpnext/commit/1359a77e7245cef415ba5f1988b45b7e2c64f0c8)) * skip warning for free items ([2adab1d](https://github.com/frappe/erpnext/commit/2adab1d36f2bace8185bb761706f855a2a7b2a18)) * stock reco current valuation rate ([3b7c38d](https://github.com/frappe/erpnext/commit/3b7c38da1095f246af15e91398e73a32964efbda)) * the project document timed out while opening ([28cbce4](https://github.com/frappe/erpnext/commit/28cbce435667880ea7168b090e1b48f7d5b51cc4)) * unable to remove image from employee ([e3cceb8](https://github.com/frappe/erpnext/commit/e3cceb894b2c9eef44b6c582313dbb13b7e9efea)) * update ctx to args ([d4bc3d1](https://github.com/frappe/erpnext/commit/d4bc3d182fb7bb4409fcca949b7ff338984496f7)) ### Features * add repost accounting ledger entry for payment entry ([757dd3f](https://github.com/frappe/erpnext/commit/757dd3f0b62c7c207a8a0e02f9ae59fffe47e6b3)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 6542e611c1e..0d3e27a42e2 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.51.2" +__version__ = "15.52.0" def get_default_company(user=None): From 16e8a00f452a8fc08b830e064a4d02da038bf144 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 19 Feb 2025 11:50:41 +0000 Subject: [PATCH 56/94] chore(release): Bumped to Version 15.53.0 # [15.53.0](https://github.com/frappe/erpnext/compare/v15.52.0...v15.53.0) (2025-02-19) ### Bug Fixes * add accounting dimensions section in sales order item ([b32e4da](https://github.com/frappe/erpnext/commit/b32e4daf2b2a38e31b7e9213eb05d71217c94269)) * add is_new in if condition ([fc2ec7c](https://github.com/frappe/erpnext/commit/fc2ec7c49577ee443f3196d47a98068d151a7712)) * add validate to allow equity account and party_type shareholder ([bb3eb81](https://github.com/frappe/erpnext/commit/bb3eb8117043ceea1558ea85349511d23bb704b1)) * allow scrap item with zero qty ([abe5384](https://github.com/frappe/erpnext/commit/abe5384449ac151a336f901ac5367e27aa6f484a)) * auto create asset due to message error (backport [#45934](https://github.com/frappe/erpnext/issues/45934)) ([#45952](https://github.com/frappe/erpnext/issues/45952)) ([830edb8](https://github.com/frappe/erpnext/commit/830edb8f524c23f749d80549bf0f92aa27c7ac18)) * check if employee is currently working on another workstation ([22eaa14](https://github.com/frappe/erpnext/commit/22eaa141790814d28baecb7f54758cdaa07d3eb9)) * disable partial payment in pos (backport [#45752](https://github.com/frappe/erpnext/issues/45752)) ([#45945](https://github.com/frappe/erpnext/issues/45945)) ([38edc46](https://github.com/frappe/erpnext/commit/38edc46c46d9d3a46206f68115bebcee7c7218e5)) * do not reschedule depreciation for fully depreciated asset on scrap ([1e7c5ec](https://github.com/frappe/erpnext/commit/1e7c5ec0cb0cda95dabf704eb5b17761d98bab4f)) * fetch child account data for selected parent ([#45904](https://github.com/frappe/erpnext/issues/45904)) ([e36b860](https://github.com/frappe/erpnext/commit/e36b860a799537831d7e4d8be8b18b106f63dc12)) * handle division by zero error (backport [#45966](https://github.com/frappe/erpnext/issues/45966)) ([#46015](https://github.com/frappe/erpnext/issues/46015)) ([15106b4](https://github.com/frappe/erpnext/commit/15106b49b6d2101455a9244dcf0837b827f9ca01)) * include missing payment_gateway parameter in Payment Request URL ([18f9476](https://github.com/frappe/erpnext/commit/18f94765f70a99535a9832784c3f0fb47bc44c16)) * letter head for quality inspection ([c289fef](https://github.com/frappe/erpnext/commit/c289fef3b5f5945506a0b40fe722e518b2836e7a)) * link correct row item of purchase doc ([87f337b](https://github.com/frappe/erpnext/commit/87f337b6053bc20f7c83960a802af27596080552)) * make purchase_receipt_item and purchase_invoice_item fields of data type ([281431e](https://github.com/frappe/erpnext/commit/281431e041090d50ebff43e76b114a2608f6d4bc)) * millisecond issue for posting datetime ([4292365](https://github.com/frappe/erpnext/commit/42923656eea4e69a8a709495bb8579fad6b42db5)) * patch for creating asset depreciation schedule records ([f043b46](https://github.com/frappe/erpnext/commit/f043b466964bad71dcf69aab4a5db04090be40df)) * pos accounting dimension fieldname error (backport [#45899](https://github.com/frappe/erpnext/issues/45899)) ([#45921](https://github.com/frappe/erpnext/issues/45921)) ([e998f06](https://github.com/frappe/erpnext/commit/e998f063a99a4ef8b3f2005a246cc50101fb8e6a)) * **pos profile:** check company while validating mandatory accounting dimension ([#45974](https://github.com/frappe/erpnext/issues/45974)) ([6a57743](https://github.com/frappe/erpnext/commit/6a577438aa93d00160fde18887e7bdc6a58ce3ed)) * pos return validation on v15 ([#45951](https://github.com/frappe/erpnext/issues/45951)) ([dd34bbe](https://github.com/frappe/erpnext/commit/dd34bbe570af6fc5e6c57727ee111f4b51226a3e)) * provision to enable naming series for SABB ([8fbfe14](https://github.com/frappe/erpnext/commit/8fbfe14c633826ea6a944214acf3368c6ff3cfe4)) * **quotation:** fetch exchange rate on currency change ([bd89c19](https://github.com/frappe/erpnext/commit/bd89c19c98fca7e90a22ccde96aa92cba2d29566)) * remove party type from validate ([0d21151](https://github.com/frappe/erpnext/commit/0d2115197e5345b532cdee80dfcb0029acea348e)) * remove public access to list items (backport [#45838](https://github.com/frappe/erpnext/issues/45838)) ([#46018](https://github.com/frappe/erpnext/issues/46018)) ([eead6d4](https://github.com/frappe/erpnext/commit/eead6d46ff8dbb8b76090d9bdbc03f033ecd5fbe)) * remove unused code ([dd5d144](https://github.com/frappe/erpnext/commit/dd5d144b55c78e6819560da48544ed9888568149)) * **report:** add options to multiselectlist fields ([7e85a12](https://github.com/frappe/erpnext/commit/7e85a123b243091eaee83ee59b3bcb21aa69aa76)) * reset location only if there is value in row item location field ([a509568](https://github.com/frappe/erpnext/commit/a50956811079ca6b23e613dc8f5487b515285797)) * resolved conflicts ([84647a1](https://github.com/frappe/erpnext/commit/84647a1c73c9dea83d1706e4a8ec7739414c0f12)) * round sum amount in JE auditing PF ([#45961](https://github.com/frappe/erpnext/issues/45961)) ([44e1ca9](https://github.com/frappe/erpnext/commit/44e1ca9d0549b7401c8945a48fbf15f79867d81b)) * **send_message:** escape HTML in the text ([cbec989](https://github.com/frappe/erpnext/commit/cbec989a7cdf15be0367e8d1b1d52ebeefc928f3)) * serial no status for internal transfer delivery note ([2b80c00](https://github.com/frappe/erpnext/commit/2b80c009b3ec7133736cfbfb0e99af295deac2ff)) * set default value to 0 as per new logic ([1abe1a1](https://github.com/frappe/erpnext/commit/1abe1a1fd50bc6b860ebde52e56be07859fb8436)) * set sco_qty field of PO to non negative ([567fb8a](https://github.com/frappe/erpnext/commit/567fb8abd1de19c1a36735e2e23e7c50a7c65129)) * slow query ([8306d6f](https://github.com/frappe/erpnext/commit/8306d6fdb6a9ab08d0458dd0c77673e372f85da3)) * stock reservation for sales invoice ([1fb5586](https://github.com/frappe/erpnext/commit/1fb5586f569015fc41aca80eb591c8996fedb947)) * stock reservation not working for sales invoice with update stock ([7d871f6](https://github.com/frappe/erpnext/commit/7d871f6bb54bccb4615d414cef82c78ba21c5302)) * tests ([f63a9db](https://github.com/frappe/erpnext/commit/f63a9dbf9b7b5141e945cd372e6bc10a6af45333)) * throw correct exception ([5bccf9f](https://github.com/frappe/erpnext/commit/5bccf9f837e2d5a1e97a2f3d42afd74887a29ba8)) * validate if no matching item found ([6183b38](https://github.com/frappe/erpnext/commit/6183b380890a3a5445ac3277d63ba945efd6738e)) * validate payment request total of partly paid invoice ([c8881a9](https://github.com/frappe/erpnext/commit/c8881a93584f0969134da170b57bd0e9d32eaa70)) ### Features * added ability to use custom html format for process statement of accounts (copy [#45746](https://github.com/frappe/erpnext/issues/45746)) ([#46012](https://github.com/frappe/erpnext/issues/46012)) ([1a4297a](https://github.com/frappe/erpnext/commit/1a4297ac35adcf36055ddc2619dc95ad257acb87)) * added option to enforce free item qty in pricing rule ([8fb9228](https://github.com/frappe/erpnext/commit/8fb9228871cdf27c5acb757297525da22cdf101b)) * disable auto setting grand total to default mode of payment (backport [#45591](https://github.com/frappe/erpnext/issues/45591)) ([#45917](https://github.com/frappe/erpnext/issues/45917)) ([e271a5c](https://github.com/frappe/erpnext/commit/e271a5cba0a969bd54fc57c3e384b7f3c226cecb)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 0d3e27a42e2..19ac3edc6ab 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.52.0" +__version__ = "15.53.0" def get_default_company(user=None): From 1d818e15109477abb5ae8789dba48af4efebc723 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Thu, 20 Feb 2025 09:05:17 +0530 Subject: [PATCH 57/94] fix: inventory dimension for maintence visit (cherry picked from commit cd4ba69262d7f99b54d5744b3b649bf345430175) (cherry picked from commit ec3b281a3b0ff2d92af2accb1b6cd4353c801392) --- .../doctype/inventory_dimension/inventory_dimension.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/inventory_dimension/inventory_dimension.py b/erpnext/stock/doctype/inventory_dimension/inventory_dimension.py index 524c7331bc7..75366d823a3 100644 --- a/erpnext/stock/doctype/inventory_dimension/inventory_dimension.py +++ b/erpnext/stock/doctype/inventory_dimension/inventory_dimension.py @@ -237,7 +237,12 @@ class InventoryDimension(Document): custom_fields["Stock Ledger Entry"] = dimension_field filter_custom_fields = {} - ignore_doctypes = ["Serial and Batch Bundle", "Serial and Batch Entry", "Pick List Item"] + ignore_doctypes = [ + "Serial and Batch Bundle", + "Serial and Batch Entry", + "Pick List Item", + "Maintenance Visit Purpose", + ] if custom_fields: for doctype, fields in custom_fields.items(): From 9e824fc4fea15752ad3d5b788899ca54dc13a89c Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Fri, 21 Feb 2025 10:01:58 +0000 Subject: [PATCH 58/94] chore(release): Bumped to Version 15.53.1 ## [15.53.1](https://github.com/frappe/erpnext/compare/v15.53.0...v15.53.1) (2025-02-21) ### Bug Fixes * inventory dimension for maintence visit ([1d818e1](https://github.com/frappe/erpnext/commit/1d818e15109477abb5ae8789dba48af4efebc723)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 19ac3edc6ab..5c95b028429 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.53.0" +__version__ = "15.53.1" def get_default_company(user=None): From d9c1b58fc34415106e5957ded292c8c3963719c5 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 26 Feb 2025 12:58:53 +0000 Subject: [PATCH 59/94] chore(release): Bumped to Version 15.53.2 ## [15.53.2](https://github.com/frappe/erpnext/compare/v15.53.1...v15.53.2) (2025-02-26) ### Bug Fixes * check value as int ([97d3e86](https://github.com/frappe/erpnext/commit/97d3e8648b4b8027e4981fe14089742aadb6f495)) * enable fetch_timesheet_in_sales_invoice in test ([feb64cb](https://github.com/frappe/erpnext/commit/feb64cb9b5e28ba2c8471fee975e42cff37d0acf)) * incorrect stock value difference for adjustment entry ([96d44e3](https://github.com/frappe/erpnext/commit/96d44e362de1216d07e91d8d313551a48f0606d4)) * inventory dimension for maintence visit ([ec3b281](https://github.com/frappe/erpnext/commit/ec3b281a3b0ff2d92af2accb1b6cd4353c801392)) * no permission to get project settings in sales invoice ([b8281c3](https://github.com/frappe/erpnext/commit/b8281c34e2108753f75eacdf2a4322dd873e98ac)) * pos opening entry dialog not saving on change data (backport [#46066](https://github.com/frappe/erpnext/issues/46066)) ([#46067](https://github.com/frappe/erpnext/issues/46067)) ([0ae2d61](https://github.com/frappe/erpnext/commit/0ae2d61974a767d377f685cd485b367f65ab1126)) * **project settings:** add checkbox to auto fetch timesheet in sales invoice ([b3c1df8](https://github.com/frappe/erpnext/commit/b3c1df8561985988b43e1f08c17543c3a0e85d16)) * **sales invoice:** check fetch_timesheet_in_sales_invoice enabled before fetching the timesheet ([b1095bb](https://github.com/frappe/erpnext/commit/b1095bb91ba1d352792bec7f7d81810d41f9ef9f)) * valuation rate for batch ([c72dab4](https://github.com/frappe/erpnext/commit/c72dab49f4079c7bcf353b6db605247a0d83fd5f)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 5c95b028429..563ea0fc1d7 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.53.1" +__version__ = "15.53.2" def get_default_company(user=None): From 8eddc09bbac1197843faccb9efef986e8170c04e Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Fri, 28 Feb 2025 09:48:11 +0530 Subject: [PATCH 60/94] fix: removed mandatory property for the cost center field (cherry picked from commit 079cf772aaf519eb6b16abef16a6d0f85187988b) --- erpnext/selling/doctype/sales_order_item/sales_order_item.json | 3 +-- erpnext/selling/doctype/sales_order_item/sales_order_item.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/erpnext/selling/doctype/sales_order_item/sales_order_item.json b/erpnext/selling/doctype/sales_order_item/sales_order_item.json index 500a7657176..ea1a646ba2d 100644 --- a/erpnext/selling/doctype/sales_order_item/sales_order_item.json +++ b/erpnext/selling/doctype/sales_order_item/sales_order_item.json @@ -946,7 +946,6 @@ "options": "Cost Center", "print_hide": 1, "print_width": "120px", - "reqd": 1, "width": "120px" }, { @@ -965,7 +964,7 @@ "idx": 1, "istable": 1, "links": [], - "modified": "2025-02-06 13:29:24.619850", + "modified": "2025-02-28 09:45:43.934947", "modified_by": "Administrator", "module": "Selling", "name": "Sales Order Item", diff --git a/erpnext/selling/doctype/sales_order_item/sales_order_item.py b/erpnext/selling/doctype/sales_order_item/sales_order_item.py index 7f2a37b1616..2fa06ac7299 100644 --- a/erpnext/selling/doctype/sales_order_item/sales_order_item.py +++ b/erpnext/selling/doctype/sales_order_item/sales_order_item.py @@ -32,7 +32,7 @@ class SalesOrderItem(Document): brand: DF.Link | None company_total_stock: DF.Float conversion_factor: DF.Float - cost_center: DF.Link + cost_center: DF.Link | None customer_item_code: DF.Data | None delivered_by_supplier: DF.Check delivered_qty: DF.Float From 9186f13458a98579ffcfa568effe19746d6163cd Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Sat, 1 Mar 2025 21:34:06 +0530 Subject: [PATCH 61/94] fix: stock qty not recalculate on changing of the qty (cherry picked from commit 464e3339fed51b80addbff455022fb9d6c8147cd) (cherry picked from commit 331798babc6f7ad40d0e5d9b73c71b1eef66409d) --- erpnext/public/js/controllers/transaction.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 81a8a617e64..69ecac19852 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -1331,6 +1331,8 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe () => this.calculate_stock_uom_rate(doc, cdt, cdn), () => this.apply_pricing_rule(item, true) ]); + } else { + this.conversion_factor(doc, cdt, cdn, true) } } From bcd02df6fdc0a1d7308efe10ac4eb704ffa78d8a Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Mon, 3 Mar 2025 04:02:37 +0000 Subject: [PATCH 62/94] chore(release): Bumped to Version 15.53.3 ## [15.53.3](https://github.com/frappe/erpnext/compare/v15.53.2...v15.53.3) (2025-03-03) ### Bug Fixes * stock qty not recalculate on changing of the qty ([9186f13](https://github.com/frappe/erpnext/commit/9186f13458a98579ffcfa568effe19746d6163cd)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 563ea0fc1d7..81ffd53ca91 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.53.2" +__version__ = "15.53.3" def get_default_company(user=None): From 171f9664216f5cd940de8df4c26c60967d3bdc1d Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Mon, 3 Mar 2025 05:12:02 +0000 Subject: [PATCH 63/94] chore(release): Bumped to Version 15.53.4 ## [15.53.4](https://github.com/frappe/erpnext/compare/v15.53.3...v15.53.4) (2025-03-03) ### Bug Fixes * removed mandatory property for the cost center field ([8eddc09](https://github.com/frappe/erpnext/commit/8eddc09bbac1197843faccb9efef986e8170c04e)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 81ffd53ca91..1387ffdc4f3 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.53.3" +__version__ = "15.53.4" def get_default_company(user=None): From 528107e2245955b3005483a8825f888455c59c2b Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 5 Mar 2025 13:31:02 +0000 Subject: [PATCH 64/94] chore(release): Bumped to Version 15.54.0 # [15.54.0](https://github.com/frappe/erpnext/compare/v15.53.4...v15.54.0) (2025-03-05) ### Bug Fixes * Accounting Period validation throwing for different companies ([6df9cf3](https://github.com/frappe/erpnext/commit/6df9cf327db7a66ceaceeff87f1edd82232f9c4d)) * Add company filter at get_invoice method (backport [#46238](https://github.com/frappe/erpnext/issues/46238)) ([#46299](https://github.com/frappe/erpnext/issues/46299)) ([4f80ddd](https://github.com/frappe/erpnext/commit/4f80ddd8348d5004744ba5d39ab1bb73bff8c923)) * Add permission check in POS's `Toggle Recent Orders` (backport [#46010](https://github.com/frappe/erpnext/issues/46010)) ([#46274](https://github.com/frappe/erpnext/issues/46274)) ([7759775](https://github.com/frappe/erpnext/commit/7759775ee6696038c241466e120edefd193253a7)) * adding cost center on pos invoice items while applying product discount (backport [#46082](https://github.com/frappe/erpnext/issues/46082)) ([#46322](https://github.com/frappe/erpnext/issues/46322)) ([9a433a6](https://github.com/frappe/erpnext/commit/9a433a675022b48d8edbac5aa6fdd57c6ea01c02)) * **asset depreciation schedules:** enable auto commit ([899e468](https://github.com/frappe/erpnext/commit/899e468f6a70000a10f104a9db5fc53e36ee160e)) * auto allocation for negative amount outstanding for Customers in Payment Entry ([78a329e](https://github.com/frappe/erpnext/commit/78a329e5738c92e34e6cac0350263aa40b93c940)) * Batch Price gets updated only if it is a billed item ([dbd47df](https://github.com/frappe/erpnext/commit/dbd47dff985019d18a5b68de44149e81dd1663cf)) * Batch Price gets updated only if it is a billed item ([8ed512f](https://github.com/frappe/erpnext/commit/8ed512f6c6e7cced1e48fb93ed71e9a08a46a8aa)) * change voucher_type and voucher_no field type to data ([3a03865](https://github.com/frappe/erpnext/commit/3a03865a8f057283a0ce757acf920ca6d1750e46)) * Close and Reopen buttons dissapear after saving changes ([#46048](https://github.com/frappe/erpnext/issues/46048)) ([506dd3c](https://github.com/frappe/erpnext/commit/506dd3c6b94c25b1db4f35bf62fabf9d44f5ac00)) * consider journal entry and return invoice in paid_amount calculation (backport [#46129](https://github.com/frappe/erpnext/issues/46129)) ([#46319](https://github.com/frappe/erpnext/issues/46319)) ([836fd8f](https://github.com/frappe/erpnext/commit/836fd8fbc4a873e4dde27d130b0006ad3eb354d5)) * consolidate gl entries by project in General Ledger Report (backport [#46314](https://github.com/frappe/erpnext/issues/46314)) ([#46321](https://github.com/frappe/erpnext/issues/46321)) ([6aa8803](https://github.com/frappe/erpnext/commit/6aa8803068752b1e1906b0ce664bcacd0b9cb0bb)) * Convert tuple of tuples to list of dicts for dot notation access ([#46062](https://github.com/frappe/erpnext/issues/46062)) ([ef19551](https://github.com/frappe/erpnext/commit/ef195513d0056f9b8069532e310e4902f469c564)) * delivery note from sales order uom conversion mistake ([d10add4](https://github.com/frappe/erpnext/commit/d10add4b1ecddff754e822d3558b9917117baf17)) * depreciation and balances report correction (backport [#46259](https://github.com/frappe/erpnext/issues/46259)) ([#46305](https://github.com/frappe/erpnext/issues/46305)) ([087dde5](https://github.com/frappe/erpnext/commit/087dde5873fe64979307856be0a68e38a5f2b445)) * discount accounting for v15 ([f609012](https://github.com/frappe/erpnext/commit/f609012f02c28317dec6a03f986ee25689879312)) * do not include opening invoices in billed items to be received report ([eee500f](https://github.com/frappe/erpnext/commit/eee500f20e8c9df46e72cf7151d777016dbdc089)) * don't allow renaming account while system is actively in use (backport [#46176](https://github.com/frappe/erpnext/issues/46176)) ([#46210](https://github.com/frappe/erpnext/issues/46210)) ([faee8d6](https://github.com/frappe/erpnext/commit/faee8d6c5e54184cbc223f3a2dd1f21e5b41b63e)) * dont update rate of free item when batch is updated ([9e649d8](https://github.com/frappe/erpnext/commit/9e649d852237a54bae334f7c6f413cbdd38f54c5)) * error ([61d5680](https://github.com/frappe/erpnext/commit/61d5680c8daf0b683be3460487711f98ac2d2232)) * exclude already consumed purchase receipt items from asset capitalization (backport [#46329](https://github.com/frappe/erpnext/issues/46329)) ([#46336](https://github.com/frappe/erpnext/issues/46336)) ([6c1ceff](https://github.com/frappe/erpnext/commit/6c1ceff8eeb1df3224f83210eb889b5066ed57e9)) * exclude cancelled gl entries ([5e08386](https://github.com/frappe/erpnext/commit/5e083861a419b6ead0071df9004f5c3d1c6f4977)) * fiscal year error ([7b13d8c](https://github.com/frappe/erpnext/commit/7b13d8cd98763a2936cdf1e56ba798f36f85c1e5)) * fixing test case ([9f4311e](https://github.com/frappe/erpnext/commit/9f4311e7fbaa4ad607747f61a3a4b95ab61b75a2)) * if invoice is return then add amount in proper column ([0a65217](https://github.com/frappe/erpnext/commit/0a65217423035b0fe6e8a2934f1bd2aed85e2ac9)) * Include additional account types for Expense Account in LCV (backport [#46206](https://github.com/frappe/erpnext/issues/46206)) ([#46296](https://github.com/frappe/erpnext/issues/46296)) ([88234bb](https://github.com/frappe/erpnext/commit/88234bbf9a6ca7c42ff093469a323ac751112185)) * incorrect batch picked ([e94f0b1](https://github.com/frappe/erpnext/commit/e94f0b1ccaa6b2cf96c67cd4013c76343b668ff3)) * incorrect batch picked in the pick list (backport [#45761](https://github.com/frappe/erpnext/issues/45761)) ([#46315](https://github.com/frappe/erpnext/issues/46315)) ([5a3073c](https://github.com/frappe/erpnext/commit/5a3073c4c145a0ae3862c824be71e6d5f6e5ef1c)) * incorrectly billed amount in the purchase receipt ([c247cf8](https://github.com/frappe/erpnext/commit/c247cf888b03cfcf172d90110611a89e23c16338)) * Naming of Purchase Amount (backport [#46051](https://github.com/frappe/erpnext/issues/46051)) ([#46324](https://github.com/frappe/erpnext/issues/46324)) ([aaf35c5](https://github.com/frappe/erpnext/commit/aaf35c5df930da736cce59861034e9ba1e9c2fb2)) * only include submitted docs for internal received quantity validation (backport [#46262](https://github.com/frappe/erpnext/issues/46262)) ([#46304](https://github.com/frappe/erpnext/issues/46304)) ([5ae9faa](https://github.com/frappe/erpnext/commit/5ae9faab91116fabe663a891d4b343ceffbc65cc)) * patch ([5e06e4a](https://github.com/frappe/erpnext/commit/5e06e4accefcff184e3e5b2477cc04c1b60eace2)) * patch ([8f2fdca](https://github.com/frappe/erpnext/commit/8f2fdcae88252cddaaeeb89f881671c2101ad886)) * patch path ([af49f5a](https://github.com/frappe/erpnext/commit/af49f5a8affe9cdfa5bacecf37be200d2c19cade)) * **patch:** Ensure SLE indexes (backport [#46131](https://github.com/frappe/erpnext/issues/46131)) ([#46135](https://github.com/frappe/erpnext/issues/46135)) ([f3cafef](https://github.com/frappe/erpnext/commit/f3cafef6a744e728b74299ac55c757fde4d94ba9)) * payment entry exchange gain loss issue ([3fb9033](https://github.com/frappe/erpnext/commit/3fb9033fb70839bcd33e9e198ac3123501be277e)) * pos item detail serial no field (backport [#46211](https://github.com/frappe/erpnext/issues/46211)) ([#46212](https://github.com/frappe/erpnext/issues/46212)) ([de0dfbc](https://github.com/frappe/erpnext/commit/de0dfbca9afaec9152462cd1f06d63d449f8fbae)) * pos item selection using serial no (backport [#46200](https://github.com/frappe/erpnext/issues/46200)) ([#46203](https://github.com/frappe/erpnext/issues/46203)) ([0f263bc](https://github.com/frappe/erpnext/commit/0f263bcff286017065b776bdafb27325a0719596)) * **pos:** get parent item group without user permission ([#46020](https://github.com/frappe/erpnext/issues/46020)) ([29f3aac](https://github.com/frappe/erpnext/commit/29f3aac925ea455c599cfb5e488c3eedc87c446f)) * production analytics report ([5668795](https://github.com/frappe/erpnext/commit/5668795884919f6fee4703ce9da2d6386148f3fd)) * rate changing on the deliver note ([75bc68b](https://github.com/frappe/erpnext/commit/75bc68b8631a2c38fe82989ce65c203742334a14)) * rearrange stock settings fields ([87703c6](https://github.com/frappe/erpnext/commit/87703c6511130a9d7885815b3ff3797b2cbb8e9a)) * removed mandatory property for the cost center field ([a94292a](https://github.com/frappe/erpnext/commit/a94292a69fb9672d2ec68762fadcc3aff99bf613)) * rename some sla fields ([c5717b9](https://github.com/frappe/erpnext/commit/c5717b983da7e0a8e117f2f4e1dd89133ce58f98)) * replacing serial and batch bundle on pos with auto fetch serial nos (backport [#46236](https://github.com/frappe/erpnext/issues/46236)) ([#46337](https://github.com/frappe/erpnext/issues/46337)) ([1e85f69](https://github.com/frappe/erpnext/commit/1e85f69072568fc92ed35a2a6b54154b5ab1ad56)) * **report:** allow `Closed` purchase orders to be visible ([20c4487](https://github.com/frappe/erpnext/commit/20c44878533e830a706a4d5f60a507a62d01038f)) * **report:** allow `Closed` sales orders to be visible ([8799af9](https://github.com/frappe/erpnext/commit/8799af974751998909fd0b73d611c39a87228a42)) * **report:** filter sales / purchase orders based on date filters ([2221bf1](https://github.com/frappe/erpnext/commit/2221bf1cba47488ce897124ea92cf31bfaf4f84f)) * revamp logic (split parent and child) ([7437cea](https://github.com/frappe/erpnext/commit/7437cea458cde7e52ed8b10d34abe38e3e966564)) * revert last commit ([a09c57f](https://github.com/frappe/erpnext/commit/a09c57f0d1429d737a2819cd5b6ea87b44843fbb)) * set landed cost based on purchase invoice rate ([fdaf5fa](https://github.com/frappe/erpnext/commit/fdaf5fafda7d1d42fe04b5b85c8e7ce16f78a14d)) * set taxes before calculating taxes and totals ([90dea42](https://github.com/frappe/erpnext/commit/90dea426d8adc86a56a37666e1f3f7b274b0df2f)) * source warehouse not fetched in bom creator ([6157fed](https://github.com/frappe/erpnext/commit/6157fed71c0a7b2cbe90cc81cb22f034b7d0a543)) * stock qty not recalculate on changing of the qty ([331798b](https://github.com/frappe/erpnext/commit/331798babc6f7ad40d0e5d9b73c71b1eef66409d)) * stock reservation issue while making Purchase Invoice ([8bd7195](https://github.com/frappe/erpnext/commit/8bd71954f3d67efbc88a3994f8870e63ef662af5)) * syntax error ([1790bcc](https://github.com/frappe/erpnext/commit/1790bcc6d1901e8f52b3efbcd80801efb876019c)) * syntax error ([bd48d39](https://github.com/frappe/erpnext/commit/bd48d391e4a9c6e78e0e9896da9ebf8bce64efc5)) * syntax error ([cc535b7](https://github.com/frappe/erpnext/commit/cc535b76365325d189d7faee0556a23679bb6bb1)) * test case for debit note ([a8b31df](https://github.com/frappe/erpnext/commit/a8b31df65ddeae3e0fcee7895dbafc9691034f10)) * tests ([46b0734](https://github.com/frappe/erpnext/commit/46b0734d6f2c0b6eaab754f6755d5510f6fa7b6b)) * tests ([d413039](https://github.com/frappe/erpnext/commit/d41303961c6ec673966bf4884d20c1a3fd3fc756)) * translation DE ([ddcf79d](https://github.com/frappe/erpnext/commit/ddcf79da1da6dfe5b9cd7f367bf86c7c41992b21)) * use else instead of unnecessary elif ([6f760d1](https://github.com/frappe/erpnext/commit/6f760d197d9620aac598ec8b2cbe509723f71d04)) * use valuation method from settings in stock ageing report (backport [#46068](https://github.com/frappe/erpnext/issues/46068)) ([#46297](https://github.com/frappe/erpnext/issues/46297)) ([d02d005](https://github.com/frappe/erpnext/commit/d02d0059139f088b343962ed20932e86216ceb6d)) * use value from currency exchange when exchange api is disabled (backport [#46137](https://github.com/frappe/erpnext/issues/46137)) ([#46309](https://github.com/frappe/erpnext/issues/46309)) ([ccc0358](https://github.com/frappe/erpnext/commit/ccc0358db6ccaa164a20e5eaa19cf95a6fe526d1)) * **workspace:** enable is_query_report on purchase reports (backport [#46249](https://github.com/frappe/erpnext/issues/46249)) ([#46306](https://github.com/frappe/erpnext/issues/46306)) ([363129b](https://github.com/frappe/erpnext/commit/363129bcd4d674df9762933ec2642330bc862e50)) * Wrong Overdue Status in Sales Invoices (Floating-point arithmetic) (backport [#46146](https://github.com/frappe/erpnext/issues/46146)) ([#46310](https://github.com/frappe/erpnext/issues/46310)) ([1ff0858](https://github.com/frappe/erpnext/commit/1ff085876e62c642694c090cbee7a65160557776)) ### Features * add new Closed and Stopped rows ([7749814](https://github.com/frappe/erpnext/commit/7749814571d8f373ada0c99111d483a47718bd51)) * add total weight in shipment ([#46049](https://github.com/frappe/erpnext/issues/46049)) ([171df3a](https://github.com/frappe/erpnext/commit/171df3aba512d3e1d9cdb26c456a9e12469066d0)) * create sales invoice print format ([#45403](https://github.com/frappe/erpnext/issues/45403)) ([1a382eb](https://github.com/frappe/erpnext/commit/1a382ebe86633cfbc5e77ae0689b0e73392aa4aa)) * **received items to be billed:** add company and date filters (backport [#46271](https://github.com/frappe/erpnext/issues/46271)) ([#46302](https://github.com/frappe/erpnext/issues/46302)) ([400f4f3](https://github.com/frappe/erpnext/commit/400f4f32adf4e789d692750ff4213a7321c41f39)) * **Sales Invoice:** add items row via "Fetch Timesheet" (backport [#46071](https://github.com/frappe/erpnext/issues/46071)) ([#46311](https://github.com/frappe/erpnext/issues/46311)) ([1c6e464](https://github.com/frappe/erpnext/commit/1c6e4649bd424cba951c0e18aa62cdefacbd5089)) ### Performance Improvements * don't track seen for POS Invoice (backport [#46187](https://github.com/frappe/erpnext/issues/46187)) ([#46189](https://github.com/frappe/erpnext/issues/46189)) ([41ab7f3](https://github.com/frappe/erpnext/commit/41ab7f3f7c0a968171e2866cdd856584f67513a9)) * patch ([ee41e55](https://github.com/frappe/erpnext/commit/ee41e55343166f88cd105fd608a3792d0fb84bb0)) * replace if function in query ([d0b8e0d](https://github.com/frappe/erpnext/commit/d0b8e0da8de036445e07301f6dc06ae8089f350c)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 1387ffdc4f3..c7a3ef15b08 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.53.4" +__version__ = "15.54.0" def get_default_company(user=None): From bb553c27ab0faade04d0718364b03654018d03da Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Thu, 6 Mar 2025 12:57:27 +0530 Subject: [PATCH 65/94] fix: rename_sla_fields patch (cherry picked from commit e8d4a487c66a6d19c420fb096aa8050064182296) (cherry picked from commit 7bc7557018bb7764b77e6892b3ffd21f9128437e) --- erpnext/patches/v15_0/rename_sla_fields.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/erpnext/patches/v15_0/rename_sla_fields.py b/erpnext/patches/v15_0/rename_sla_fields.py index 5e3e92d85c2..e5e69e0921e 100644 --- a/erpnext/patches/v15_0/rename_sla_fields.py +++ b/erpnext/patches/v15_0/rename_sla_fields.py @@ -6,8 +6,14 @@ from frappe.model.utils.rename_field import rename_field def execute(): doctypes = frappe.get_all("Service Level Agreement", pluck="document_type") for doctype in doctypes: - rename_fieldname(doctype + "-resolution_by", "sla_resolution_by") - rename_fieldname(doctype + "-resolution_date", "sla_resolution_date") + if doctype == "Issue": + continue + + if frappe.db.exists("Custom Field", {"fieldname": doctype + "-resolution_by"}): + rename_fieldname(doctype + "-resolution_by", "sla_resolution_by") + + if frappe.db.exists("Custom Field", {"fieldname": doctype + "-resolution_date"}): + rename_fieldname(doctype + "-resolution_date", "sla_resolution_date") rename_field("Issue", "resolution_by", "sla_resolution_by") rename_field("Issue", "resolution_date", "sla_resolution_date") From 041335f318c510dac7f56d2f7998135ff559fd58 Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Thu, 6 Mar 2025 12:58:53 +0530 Subject: [PATCH 66/94] fix: recalculate_amount_difference_field patch (cherry picked from commit 0492b941ffc576b81116b486c7553c2bfe729391) # Conflicts: # erpnext/patches/v15_0/recalculate_amount_difference_field.py (cherry picked from commit f247f02e49e5bb22585e81e3c687e052ff441361) --- .../recalculate_amount_difference_field.py | 101 ++++++++++++++++-- 1 file changed, 90 insertions(+), 11 deletions(-) diff --git a/erpnext/patches/v15_0/recalculate_amount_difference_field.py b/erpnext/patches/v15_0/recalculate_amount_difference_field.py index fa45211be94..dda92ecf1e8 100644 --- a/erpnext/patches/v15_0/recalculate_amount_difference_field.py +++ b/erpnext/patches/v15_0/recalculate_amount_difference_field.py @@ -1,12 +1,13 @@ import frappe from frappe.query_builder.functions import Sum -from frappe.utils import flt +from frappe.utils import flt, getdate from erpnext.accounts.utils import get_fiscal_year from erpnext.stock.doctype.purchase_receipt.purchase_receipt import adjust_incoming_rate_for_pr def execute(): +<<<<<<< HEAD table = frappe.qb.DocType("Purchase Receipt Item") parent = frappe.qb.DocType("Purchase Receipt") query = ( @@ -50,20 +51,98 @@ def execute(): adjusted_amt = flt( adjusted_amt * flt(item.conversion_rate), precision, +======= + for company in frappe.get_all("Company", pluck="name"): + table = frappe.qb.DocType("Purchase Receipt Item") + parent = frappe.qb.DocType("Purchase Receipt") + query = ( + frappe.qb.from_(table) + .join(parent) + .on(table.parent == parent.name) + .select( + table.parent, + table.name, + table.amount, + table.billed_amt, + table.amount_difference_with_purchase_invoice, + table.rate, + table.qty, + parent.conversion_rate, +>>>>>>> 0492b941ff (fix: recalculate_amount_difference_field patch) ) + .where( + (table.amount_difference_with_purchase_invoice != 0) + & (table.docstatus == 1) + & (parent.company == company) + ) + ) - if adjusted_amt != item.amount_difference_with_purchase_invoice: - frappe.db.set_value( - "Purchase Receipt Item", - item.name, - "amount_difference_with_purchase_invoice", - adjusted_amt, - update_modified=False, + posting_date = "2024-04-01" + + # Get the last accounting period end date + accounting_period = frappe.get_all( + "Accounting Period", {"company": company}, ["end_date"], order_by="end_date desc", limit=1 + ) + if ( + accounting_period + and accounting_period[0].end_date + and getdate(accounting_period[0].end_date) > getdate(posting_date) + ): + posting_date = accounting_period[0].end_date + + # Get the last period closing voucher end date + period_closing_voucher = frappe.get_all( + "Period Closing Voucher", + {"company": company, "docstatus": 1}, + ["period_end_date"], + order_by="period_end_date desc", + limit=1, + ) + if ( + period_closing_voucher + and period_closing_voucher[0].period_end_date + and getdate(period_closing_voucher[0].period_end_date) > getdate(posting_date) + ): + posting_date = period_closing_voucher[0].period_end_date + + fiscal_year = get_fiscal_year(frappe.utils.datetime.date.today(), raise_on_missing=False) + if fiscal_year and getdate(fiscal_year[1]) > getdate(posting_date): + posting_date = fiscal_year[1] + query = query.where(parent.posting_date > posting_date) + + if result := query.run(as_dict=True): + item_wise_billed_qty = get_billed_qty_against_purchase_receipt([item.name for item in result]) + + purchase_receipts = set() + precision = frappe.get_precision("Purchase Receipt Item", "amount") + for item in result: + adjusted_amt = 0.0 + + if ( + item.billed_amt is not None + and item.amount is not None + and item_wise_billed_qty.get(item.name) + ): + adjusted_amt = ( + flt(item.billed_amt / item_wise_billed_qty.get(item.name)) - flt(item.rate) + ) * item.qty + adjusted_amt = flt( + adjusted_amt * flt(item.conversion_rate), + precision, ) - purchase_receipts.add(item.parent) - for pr in purchase_receipts: - adjust_incoming_rate_for_pr(frappe.get_doc("Purchase Receipt", pr)) + if adjusted_amt != item.amount_difference_with_purchase_invoice: + frappe.db.set_value( + "Purchase Receipt Item", + item.name, + "amount_difference_with_purchase_invoice", + adjusted_amt, + update_modified=False, + ) + purchase_receipts.add(item.parent) + + for pr in purchase_receipts: + adjust_incoming_rate_for_pr(frappe.get_doc("Purchase Receipt", pr)) def get_billed_qty_against_purchase_receipt(pr_names): From 12bf31df87c9b09f7c1acf31102705faebf125b1 Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Thu, 6 Mar 2025 13:11:31 +0530 Subject: [PATCH 67/94] fix: check if set_landed_cost_based_on_purchase_invoice_rate is enabled before running patch (cherry picked from commit 95d197693151610bda2926db46f70e1cf9f6838c) # Conflicts: # erpnext/patches/v15_0/recalculate_amount_difference_field.py (cherry picked from commit 7047fe26812fbb48d80e3a24f438a9c1c5d8683f) --- .../patches/v15_0/recalculate_amount_difference_field.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/erpnext/patches/v15_0/recalculate_amount_difference_field.py b/erpnext/patches/v15_0/recalculate_amount_difference_field.py index dda92ecf1e8..d0a42e7cc5e 100644 --- a/erpnext/patches/v15_0/recalculate_amount_difference_field.py +++ b/erpnext/patches/v15_0/recalculate_amount_difference_field.py @@ -7,6 +7,7 @@ from erpnext.stock.doctype.purchase_receipt.purchase_receipt import adjust_incom def execute(): +<<<<<<< HEAD <<<<<<< HEAD table = frappe.qb.DocType("Purchase Receipt Item") parent = frappe.qb.DocType("Purchase Receipt") @@ -52,6 +53,11 @@ def execute(): adjusted_amt * flt(item.conversion_rate), precision, ======= +======= + if not frappe.db.get_single_value("Buying Settings", "set_landed_cost_based_on_purchase_invoice_rate"): + return + +>>>>>>> 95d1976931 (fix: check if set_landed_cost_based_on_purchase_invoice_rate is enabled before running patch) for company in frappe.get_all("Company", pluck="name"): table = frappe.qb.DocType("Purchase Receipt Item") parent = frappe.qb.DocType("Purchase Receipt") From 525780645a0edf5b5ea76c9a9faecf4368e0866e Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Thu, 6 Mar 2025 14:13:55 +0530 Subject: [PATCH 68/94] chore: resolve conflicts (cherry picked from commit 8e65b0ec0c0bb8e00ecc2e3b104bf4694883926c) --- .../recalculate_amount_difference_field.py | 59 +++---------------- 1 file changed, 7 insertions(+), 52 deletions(-) diff --git a/erpnext/patches/v15_0/recalculate_amount_difference_field.py b/erpnext/patches/v15_0/recalculate_amount_difference_field.py index d0a42e7cc5e..7d3d957fe62 100644 --- a/erpnext/patches/v15_0/recalculate_amount_difference_field.py +++ b/erpnext/patches/v15_0/recalculate_amount_difference_field.py @@ -7,57 +7,9 @@ from erpnext.stock.doctype.purchase_receipt.purchase_receipt import adjust_incom def execute(): -<<<<<<< HEAD -<<<<<<< HEAD - table = frappe.qb.DocType("Purchase Receipt Item") - parent = frappe.qb.DocType("Purchase Receipt") - query = ( - frappe.qb.from_(table) - .join(parent) - .on(table.parent == parent.name) - .select( - table.parent, - table.name, - table.amount, - table.billed_amt, - table.amount_difference_with_purchase_invoice, - table.rate, - table.qty, - parent.conversion_rate, - ) - .where((table.amount_difference_with_purchase_invoice != 0) & (table.docstatus == 1)) - ) - try: - if fiscal_year_dates := get_fiscal_year(frappe.utils.datetime.date.today()): - query.where(parent.posting_date.between(fiscal_year_dates[1], fiscal_year_dates[2])) - except Exception: - return - - if result := query.run(as_dict=True): - item_wise_billed_qty = get_billed_qty_against_purchase_receipt([item.name for item in result]) - - purchase_receipts = set() - precision = frappe.get_precision("Purchase Receipt Item", "amount") - for item in result: - adjusted_amt = 0.0 - - if ( - item.billed_amt is not None - and item.amount is not None - and item_wise_billed_qty.get(item.name) - ): - adjusted_amt = ( - flt(item.billed_amt / item_wise_billed_qty.get(item.name)) - flt(item.rate) - ) * item.qty - adjusted_amt = flt( - adjusted_amt * flt(item.conversion_rate), - precision, -======= -======= if not frappe.db.get_single_value("Buying Settings", "set_landed_cost_based_on_purchase_invoice_rate"): return ->>>>>>> 95d1976931 (fix: check if set_landed_cost_based_on_purchase_invoice_rate is enabled before running patch) for company in frappe.get_all("Company", pluck="name"): table = frappe.qb.DocType("Purchase Receipt Item") parent = frappe.qb.DocType("Purchase Receipt") @@ -74,7 +26,6 @@ def execute(): table.rate, table.qty, parent.conversion_rate, ->>>>>>> 0492b941ff (fix: recalculate_amount_difference_field patch) ) .where( (table.amount_difference_with_purchase_invoice != 0) @@ -111,9 +62,13 @@ def execute(): ): posting_date = period_closing_voucher[0].period_end_date - fiscal_year = get_fiscal_year(frappe.utils.datetime.date.today(), raise_on_missing=False) - if fiscal_year and getdate(fiscal_year[1]) > getdate(posting_date): - posting_date = fiscal_year[1] + try: + fiscal_year = get_fiscal_year(frappe.utils.datetime.date.today()) + except Exception: + return + else: + if fiscal_year and getdate(fiscal_year[1]) > getdate(posting_date): + posting_date = fiscal_year[1] query = query.where(parent.posting_date > posting_date) if result := query.run(as_dict=True): From 7c8b34fd8f99194f7d593680873b563aa685eabd Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Thu, 6 Mar 2025 11:05:55 +0000 Subject: [PATCH 69/94] chore(release): Bumped to Version 15.54.1 ## [15.54.1](https://github.com/frappe/erpnext/compare/v15.54.0...v15.54.1) (2025-03-06) ### Bug Fixes * check if set_landed_cost_based_on_purchase_invoice_rate is enabled before running patch ([12bf31d](https://github.com/frappe/erpnext/commit/12bf31df87c9b09f7c1acf31102705faebf125b1)) * recalculate_amount_difference_field patch ([041335f](https://github.com/frappe/erpnext/commit/041335f318c510dac7f56d2f7998135ff559fd58)) * rename_sla_fields patch ([bb553c2](https://github.com/frappe/erpnext/commit/bb553c27ab0faade04d0718364b03654018d03da)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index c7a3ef15b08..7e5036a5a0e 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.54.0" +__version__ = "15.54.1" def get_default_company(user=None): From 5c47c35a0fda1335b60e13986d7cd64bf28c4c94 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 21 Feb 2025 15:40:35 +0530 Subject: [PATCH 70/94] refactor: use highest precision for storing exc rate (cherry picked from commit b115bf2e2a6a510f761f0a73124bfa915cdfca46) --- erpnext/accounts/doctype/gl_entry/gl_entry.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/gl_entry/gl_entry.json b/erpnext/accounts/doctype/gl_entry/gl_entry.json index c285a33f73e..b438dbbe4ec 100644 --- a/erpnext/accounts/doctype/gl_entry/gl_entry.json +++ b/erpnext/accounts/doctype/gl_entry/gl_entry.json @@ -279,7 +279,8 @@ { "fieldname": "transaction_exchange_rate", "fieldtype": "Float", - "label": "Transaction Exchange Rate" + "label": "Transaction Exchange Rate", + "precision": "9" }, { "fieldname": "debit_in_transaction_currency", @@ -357,7 +358,7 @@ "idx": 1, "in_create": 1, "links": [], - "modified": "2024-08-22 13:03:39.997475", + "modified": "2025-02-21 14:36:49.431166", "modified_by": "Administrator", "module": "Accounts", "name": "GL Entry", From 1e5fbc0a48ceb3337d2eede22fa7a525e227ff4a Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 21 Feb 2025 15:42:01 +0530 Subject: [PATCH 71/94] refactor: set tr currency dr & cr directly on parent document (cherry picked from commit e9af5670334ca8fa45cf42414989abca09cdb45a) --- .../purchase_invoice/purchase_invoice.py | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index 3ab214751f7..87112ea7c92 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -871,8 +871,14 @@ class PurchaseInvoice(BuyingController): self.make_payment_gl_entries(gl_entries) self.make_write_off_gl_entry(gl_entries) self.make_gle_for_rounding_adjustment(gl_entries) + self.set_transaction_currency_rate(gl_entries) return gl_entries + def set_transaction_currency_rate(self, gl_entries): + for x in gl_entries: + x["transaction_currency"] = self.currency + x["transaction_exchange_rate"] = self.get("conversion_rate") or 1 + def check_asset_cwip_enabled(self): # Check if there exists any item with cwip accounting enabled in it's asset category for item in self.get("items"): @@ -916,6 +922,7 @@ class PurchaseInvoice(BuyingController): "credit_in_account_currency": base_grand_total if self.party_account_currency == self.company_currency else grand_total, + "credit_in_transaction_currency": grand_total, "against_voucher": against_voucher, "against_voucher_type": self.doctype, "project": self.project, @@ -1054,7 +1061,9 @@ class PurchaseInvoice(BuyingController): # Amount added through landed-cost-voucher if landed_cost_entries: if (item.item_code, item.name) in landed_cost_entries: - for account, amount in landed_cost_entries[(item.item_code, item.name)].items(): + for account, base_amount in landed_cost_entries[ + (item.item_code, item.name) + ].items(): gl_entries.append( self.get_gl_dict( { @@ -1062,8 +1071,8 @@ class PurchaseInvoice(BuyingController): "against": item.expense_account, "cost_center": item.cost_center, "remarks": self.get("remarks") or _("Accounting Entry for Stock"), - "credit": flt(amount["base_amount"]), - "credit_in_account_currency": flt(amount["amount"]), + "credit": flt(base_amount["base_amount"]), + "credit_in_account_currency": flt(base_amount["amount"]), "project": item.project or self.project, }, item=item, @@ -1099,7 +1108,7 @@ class PurchaseInvoice(BuyingController): else item.deferred_expense_account ) - dummy, amount = self.get_amount_and_base_amount(item, None) + amount, base_amount = self.get_amount_and_base_amount(item, None) if provisional_accounting_for_non_stock_items: self.make_provisional_gl_entry(gl_entries, item) @@ -1110,7 +1119,8 @@ class PurchaseInvoice(BuyingController): { "account": expense_account, "against": self.supplier, - "debit": amount, + "debit": base_amount, + "debit_in_transaction_currency": amount, "cost_center": item.cost_center, "project": item.project or self.project, }, @@ -1332,6 +1342,7 @@ class PurchaseInvoice(BuyingController): dr_or_cr + "_in_account_currency": base_amount if account_currency == self.company_currency else amount, + dr_or_cr + "_in_transaction_currency": amount, "cost_center": tax.cost_center, }, account_currency, @@ -1460,6 +1471,7 @@ class PurchaseInvoice(BuyingController): "debit_in_account_currency": self.base_paid_amount if self.party_account_currency == self.company_currency else self.paid_amount, + "debit_in_transaction_currency": self.paid_amount, "against_voucher": self.return_against if cint(self.is_return) and self.return_against else self.name, @@ -1481,6 +1493,7 @@ class PurchaseInvoice(BuyingController): "credit_in_account_currency": self.base_paid_amount if bank_account_currency == self.company_currency else self.paid_amount, + "credit_in_transaction_currency": self.paid_amount, "cost_center": self.cost_center, }, bank_account_currency, @@ -1505,6 +1518,7 @@ class PurchaseInvoice(BuyingController): "debit_in_account_currency": self.base_write_off_amount if self.party_account_currency == self.company_currency else self.write_off_amount, + "debit_in_transaction_currency": self.write_off_amount, "against_voucher": self.return_against if cint(self.is_return) and self.return_against else self.name, @@ -1525,6 +1539,7 @@ class PurchaseInvoice(BuyingController): "credit_in_account_currency": self.base_write_off_amount if write_off_account_currency == self.company_currency else self.write_off_amount, + "credit_in_transaction_currency": self.write_off_amount, "cost_center": self.cost_center or self.write_off_cost_center, }, item=self, From 5299a1032b738d9891afb0ffd43a79c7e49ad7b2 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Mon, 24 Feb 2025 21:58:59 +0530 Subject: [PATCH 72/94] refactor: handle stocked items (cherry picked from commit 7ff3977394c8f2935601a3a753778bd6dd5a5592) --- erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index 87112ea7c92..b1d6ec15e3c 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -1049,6 +1049,7 @@ class PurchaseInvoice(BuyingController): "account": item.expense_account, "against": self.supplier, "debit": warehouse_debit_amount, + "debit_in_transaction_currency": item.net_amount, "remarks": self.get("remarks") or _("Accounting Entry for Stock"), "cost_center": item.cost_center, "project": item.project or self.project, From fff3b1e84ef2aa9e7b5ef8fdda5a447b95c696f0 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Tue, 25 Feb 2025 14:10:00 +0530 Subject: [PATCH 73/94] refactor: handle stocked items (cherry picked from commit ee93ed8c970deff88ef54fdcda2c5607959d29d8) --- .../accounts/doctype/purchase_invoice/purchase_invoice.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index b1d6ec15e3c..a50f7df0c09 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -998,6 +998,7 @@ class PurchaseInvoice(BuyingController): "project": item.project or self.project, "remarks": self.get("remarks") or _("Accounting Entry for Stock"), "debit": warehouse_debit_amount, + "debit_in_transaction_currency": item.net_amount, }, warehouse_account[item.warehouse]["account_currency"], item=item, @@ -1018,6 +1019,7 @@ class PurchaseInvoice(BuyingController): "project": item.project or self.project, "remarks": self.get("remarks") or _("Accounting Entry for Stock"), "debit": -1 * flt(credit_amount, item.precision("base_net_amount")), + "debit_in_transaction_currency": item.net_amount, }, warehouse_account[item.from_warehouse]["account_currency"], item=item, @@ -1032,6 +1034,7 @@ class PurchaseInvoice(BuyingController): "account": item.expense_account, "against": self.supplier, "debit": flt(item.base_net_amount, item.precision("base_net_amount")), + "debit_in_transaction_currency": item.net_amount, "remarks": self.get("remarks") or _("Accounting Entry for Stock"), "cost_center": item.cost_center, "project": item.project, @@ -1074,6 +1077,7 @@ class PurchaseInvoice(BuyingController): "remarks": self.get("remarks") or _("Accounting Entry for Stock"), "credit": flt(base_amount["base_amount"]), "credit_in_account_currency": flt(base_amount["amount"]), + "credit_in_transaction_currency": item.net_amount, "project": item.project or self.project, }, item=item, @@ -1096,6 +1100,7 @@ class PurchaseInvoice(BuyingController): "project": item.project or self.project, "remarks": self.get("remarks") or _("Accounting Entry for Stock"), "credit": flt(item.rm_supp_cost), + "credit_in_transaction_currency": item.net_amount, }, warehouse_account[self.supplier_warehouse]["account_currency"], item=item, @@ -1195,6 +1200,7 @@ class PurchaseInvoice(BuyingController): "account": stock_rbnb, "against": self.supplier, "debit": flt(item.item_tax_amount, item.precision("item_tax_amount")), + "debit_in_transaction_currency": item.net_amount, "remarks": self.remarks or _("Accounting Entry for Stock"), "cost_center": self.cost_center, "project": item.project or self.project, @@ -1310,6 +1316,7 @@ class PurchaseInvoice(BuyingController): "account": cost_of_goods_sold_account, "against": item.expense_account, "debit": stock_adjustment_amt, + "debit_in_transaction_currency": item.net_amount, "remarks": self.get("remarks") or _("Stock Adjustment"), "cost_center": item.cost_center, "project": item.project or self.project, From 231abab32117b32ae0a64474a899d6541e1a83e4 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 28 Feb 2025 17:26:19 +0530 Subject: [PATCH 74/94] refactor: set transaction currency dr/cr in sales invoice (cherry picked from commit 3e292ef2cbed31afed297e005e04f021944542fd) # Conflicts: # erpnext/accounts/doctype/sales_invoice/sales_invoice.py --- .../doctype/sales_invoice/sales_invoice.py | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 9fcb1ae526c..cd556d77274 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -1274,6 +1274,7 @@ class SalesInvoice(SellingController): "debit_in_account_currency": base_grand_total if self.party_account_currency == self.company_currency else grand_total, + "debit_in_transaction_currency": grand_total, "against_voucher": against_voucher, "against_voucher_type": self.doctype, "cost_center": self.cost_center, @@ -1305,6 +1306,9 @@ class SalesInvoice(SellingController): if account_currency == self.company_currency else flt(amount, tax.precision("tax_amount_after_discount_amount")) ), + "credit_in_transaction_currency": flt( + amount, tax.precision("tax_amount_after_discount_amount") + ), "cost_center": tax.cost_center, }, account_currency, @@ -1322,6 +1326,7 @@ class SalesInvoice(SellingController): "against": self.customer, "debit": flt(self.total_taxes_and_charges), "debit_in_account_currency": flt(self.base_total_taxes_and_charges), + "debit_in_transaction_currency": flt(self.total_taxes_and_charges), "cost_center": self.cost_center, }, account_currency, @@ -1420,6 +1425,7 @@ class SalesInvoice(SellingController): if account_currency == self.company_currency else flt(amount, item.precision("net_amount")) ), + "credit_in_transaction_currency": flt(amount, item.precision("net_amount")), "cost_center": item.cost_center, "project": item.project or self.project, }, @@ -1471,6 +1477,7 @@ class SalesInvoice(SellingController): + cstr(self.loyalty_redemption_account) + " for the Loyalty Program", "credit": self.loyalty_amount, + "credit_in_transaction_currency": self.loyalty_amount, "against_voucher": self.return_against if cint(self.is_return) else self.name, "against_voucher_type": self.doctype, "cost_center": self.cost_center, @@ -1485,6 +1492,7 @@ class SalesInvoice(SellingController): "cost_center": self.cost_center or self.loyalty_redemption_cost_center, "against": self.customer, "debit": self.loyalty_amount, + "debit_in_transaction_currency": self.loyalty_amount, "remark": "Loyalty Points redeemed by the customer", }, item=self, @@ -1518,6 +1526,7 @@ class SalesInvoice(SellingController): "credit_in_account_currency": payment_mode.base_amount if self.party_account_currency == self.company_currency else payment_mode.amount, + "credit_in_transaction_currency": payment_mode.amount, "against_voucher": against_voucher, "against_voucher_type": self.doctype, "cost_center": self.cost_center, @@ -1537,6 +1546,7 @@ class SalesInvoice(SellingController): "debit_in_account_currency": payment_mode.base_amount if payment_mode_account_currency == self.company_currency else payment_mode.amount, + "debit_in_transaction_currency": payment_mode.amount, "cost_center": self.cost_center, }, payment_mode_account_currency, @@ -1573,6 +1583,7 @@ class SalesInvoice(SellingController): ) ) +<<<<<<< HEAD gl_entries.append( self.get_gl_dict( { @@ -1586,6 +1597,44 @@ class SalesInvoice(SellingController): ) else: frappe.throw(_("Select change amount account"), title=_("Mandatory Field")) +======= + if not self.account_for_change_amount: + frappe.throw(_("Please set Account for Change Amount"), title=_("Mandatory Field")) + + return [ + self.get_gl_dict( + { + "account": self.debit_to, + "party_type": "Customer", + "party": self.customer, + "against": self.account_for_change_amount, + "debit": flt(self.base_change_amount), + "debit_in_account_currency": flt(self.base_change_amount) + if self.party_account_currency == self.company_currency + else flt(self.change_amount), + "debit_in_transaction_currency": flt(self.change_amount), + "against_voucher": self.return_against + if cint(self.is_return) and self.return_against + else self.name, + "against_voucher_type": self.doctype, + "cost_center": self.cost_center, + "project": self.project, + }, + self.party_account_currency, + item=self, + ), + self.get_gl_dict( + { + "account": self.account_for_change_amount, + "against": self.customer, + "credit": self.base_change_amount, + "credit_in_transaction_currency": self.change_amount, + "cost_center": self.cost_center, + }, + item=self, + ), + ] +>>>>>>> 3e292ef2cb (refactor: set transaction currency dr/cr in sales invoice) def make_write_off_gl_entry(self, gl_entries): # write off entries, applicable if only pos @@ -1610,6 +1659,9 @@ class SalesInvoice(SellingController): if self.party_account_currency == self.company_currency else flt(self.write_off_amount, self.precision("write_off_amount")) ), + "credit_in_transaction_currency": flt( + self.write_off_amount, self.precision("write_off_amount") + ), "against_voucher": self.return_against if cint(self.is_return) else self.name, "against_voucher_type": self.doctype, "cost_center": self.cost_center, @@ -1630,6 +1682,9 @@ class SalesInvoice(SellingController): if write_off_account_currency == self.company_currency else flt(self.write_off_amount, self.precision("write_off_amount")) ), + "debit_in_transaction_currency": flt( + self.write_off_amount, self.precision("write_off_amount") + ), "cost_center": self.cost_center or self.write_off_cost_center or default_cost_center, }, write_off_account_currency, @@ -1674,6 +1729,9 @@ class SalesInvoice(SellingController): "credit_in_account_currency": flt( self.rounding_adjustment, self.precision("rounding_adjustment") ), + "credit_in_transaction_currency": flt( + self.rounding_adjustment, self.precision("rounding_adjustment") + ), "credit": flt( self.base_rounding_adjustment, self.precision("base_rounding_adjustment") ), From 615b0c40a3e7250adffae3db0e70627460ffd3a9 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 28 Feb 2025 17:30:25 +0530 Subject: [PATCH 75/94] refactor: move utility method to controller (cherry picked from commit d1d06885dc647d0ca964850019d32d3091d1de46) --- .../accounts/doctype/purchase_invoice/purchase_invoice.py | 7 +------ erpnext/accounts/doctype/sales_invoice/sales_invoice.py | 1 + erpnext/controllers/accounts_controller.py | 5 +++++ 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index a50f7df0c09..5d12066757e 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -871,14 +871,9 @@ class PurchaseInvoice(BuyingController): self.make_payment_gl_entries(gl_entries) self.make_write_off_gl_entry(gl_entries) self.make_gle_for_rounding_adjustment(gl_entries) - self.set_transaction_currency_rate(gl_entries) + self.set_transaction_currency_and_rate_in_gl_map(gl_entries) return gl_entries - def set_transaction_currency_rate(self, gl_entries): - for x in gl_entries: - x["transaction_currency"] = self.currency - x["transaction_exchange_rate"] = self.get("conversion_rate") or 1 - def check_asset_cwip_enabled(self): # Check if there exists any item with cwip accounting enabled in it's asset category for item in self.get("items"): diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index cd556d77274..6f1b3a69605 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -1241,6 +1241,7 @@ class SalesInvoice(SellingController): self.make_write_off_gl_entry(gl_entries) self.make_gle_for_rounding_adjustment(gl_entries) + self.set_transaction_currency_and_rate_in_gl_map(gl_entries) return gl_entries def make_customer_gl_entry(self, gl_entries): diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 6ed55a0b55e..702445a29c5 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -2758,6 +2758,11 @@ class AccountsController(TransactionBase): elif self.doctype == "Payment Entry": self.make_advance_payment_ledger_for_payment() + def set_transaction_currency_and_rate_in_gl_map(self, gl_entries): + for x in gl_entries: + x["transaction_currency"] = self.currency + x["transaction_exchange_rate"] = self.get("conversion_rate") or 1 + @frappe.whitelist() def get_tax_rate(account_head): From 04758d3de3440c8480c9c957c6ad3da39c8d0cb5 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Mon, 3 Mar 2025 12:22:35 +0530 Subject: [PATCH 76/94] refactor: handle Journal entries (cherry picked from commit 9f3847c0f8b985eb21d29bb4687c1762f467e2ba) --- .../doctype/journal_entry/journal_entry.py | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index ef2388a7eaa..725364c1590 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -1059,14 +1059,15 @@ class JournalEntry(AccountsController): gl_map = [] company_currency = erpnext.get_company_currency(self.company) + self.transaction_currency = company_currency + self.transaction_exchange_rate = 1 if self.multi_currency: for row in self.get("accounts"): if row.account_currency != company_currency: - self.currency = row.account_currency - self.conversion_rate = row.exchange_rate + # Journal assumes the first foregin currency as transaction currency + self.transaction_currency = row.account_currency + self.transaction_exchange_rate = row.exchange_rate break - else: - self.currency = company_currency for d in self.get("accounts"): if d.debit or d.credit or (self.voucher_type == "Exchange Gain Or Loss"): @@ -1091,6 +1092,18 @@ class JournalEntry(AccountsController): "credit_in_account_currency": flt( d.credit_in_account_currency, d.precision("credit_in_account_currency") ), + "transaction_currency": self.transaction_currency, + "transaction_exchange_rate": self.transaction_exchange_rate, + "debit_in_transaction_currency": flt( + d.debit_in_account_currency, d.precision("debit_in_account_currency") + ) + if self.transaction_currency == d.account_currency + else flt(d.debit, d.precision("debit")) / self.transaction_exchange_rate, + "credit_in_transaction_currency": flt( + d.credit_in_account_currency, d.precision("credit_in_account_currency") + ) + if self.transaction_currency == d.account_currency + else flt(d.credit, d.precision("credit")) / self.transaction_exchange_rate, "against_voucher_type": d.reference_type, "against_voucher": d.reference_name, "remarks": remarks, From 81c29e8f8cc0c2842a60d3baf8a42d065863aeb5 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Tue, 4 Mar 2025 14:19:38 +0530 Subject: [PATCH 77/94] refactor: handle payment entry (cherry picked from commit 5c86e3ce859d9f8baa93bc709fd75abab7849700) --- .../doctype/payment_entry/payment_entry.py | 42 +++++++++++++++++-- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py index 45462398e1c..588be1df4bf 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -1222,10 +1222,15 @@ class PaymentEntry(AccountsController): self.setup_party_account_field() company_currency = erpnext.get_company_currency(self.company) + self.transaction_currency = company_currency + self.transaction_exchange_rate = 1 + if self.paid_from_account_currency != company_currency: - self.currency = self.paid_from_account_currency + self.transaction_currency = self.paid_from_account_currency + self.transaction_exchange_rate = self.source_exchange_rate elif self.paid_to_account_currency != company_currency: - self.currency = self.paid_to_account_currency + self.transaction_currency = self.paid_to_account_currency + self.transaction_exchange_rate = self.target_exchange_rate gl_entries = [] self.add_party_gl_entries(gl_entries) @@ -1304,6 +1309,9 @@ class PaymentEntry(AccountsController): "cost_center": cost_center, dr_or_cr + "_in_account_currency": d.allocated_amount, dr_or_cr: allocated_amount_in_company_currency, + dr_or_cr + "_in_transaction_currency": d.allocated_amount + if self.transaction_currency == self.party_account_currency + else allocated_amount_in_company_currency / self.transaction_exchange_rate, }, item=self, ) @@ -1348,6 +1356,9 @@ class PaymentEntry(AccountsController): "account_currency": self.party_account_currency, "cost_center": self.cost_center, dr_or_cr + "_in_account_currency": self.unallocated_amount, + dr_or_cr + "_in_transaction_currency": self.unallocated_amount + if self.party_account_currency == self.transaction_currency + else base_unallocated_amount / self.transaction_exchange_rate, dr_or_cr: base_unallocated_amount, }, item=self, @@ -1444,9 +1455,16 @@ class PaymentEntry(AccountsController): frappe.db.set_value("Payment Entry Reference", invoice.name, "reconcile_effect_on", posting_date) dr_or_cr, account = self.get_dr_and_account_for_advances(invoice) + base_allocated_amount = self.calculate_base_allocated_amount_for_reference(invoice) args_dict["account"] = account - args_dict[dr_or_cr] = self.calculate_base_allocated_amount_for_reference(invoice) + args_dict[dr_or_cr] = base_allocated_amount args_dict[dr_or_cr + "_in_account_currency"] = invoice.allocated_amount + args_dict[dr_or_cr + "_in_transaction_currency"] = ( + invoice.allocated_amount + if self.party_account_currency == self.transaction_currency + else base_allocated_amount / self.transaction_exchange_rate + ) + args_dict.update( { "against_voucher_type": invoice.reference_doctype, @@ -1464,8 +1482,13 @@ class PaymentEntry(AccountsController): args_dict[dr_or_cr + "_in_account_currency"] = 0 dr_or_cr = "debit" if dr_or_cr == "credit" else "credit" args_dict["account"] = self.party_account - args_dict[dr_or_cr] = self.calculate_base_allocated_amount_for_reference(invoice) + args_dict[dr_or_cr] = base_allocated_amount args_dict[dr_or_cr + "_in_account_currency"] = invoice.allocated_amount + args_dict[dr_or_cr + "_in_transaction_currency"] = ( + invoice.allocated_amount + if self.party_account_currency == self.transaction_currency + else base_allocated_amount / self.transaction_exchange_rate + ) args_dict.update( { "against_voucher_type": "Payment Entry", @@ -1487,6 +1510,9 @@ class PaymentEntry(AccountsController): "account_currency": self.paid_from_account_currency, "against": self.party if self.payment_type == "Pay" else self.paid_to, "credit_in_account_currency": self.paid_amount, + "credit_in_transaction_currency": self.paid_amount + if self.paid_from_account_currency == self.transaction_currency + else self.base_paid_amount / self.transaction_exchange_rate, "credit": self.base_paid_amount, "cost_center": self.cost_center, "post_net_value": True, @@ -1502,6 +1528,9 @@ class PaymentEntry(AccountsController): "account_currency": self.paid_to_account_currency, "against": self.party if self.payment_type == "Receive" else self.paid_from, "debit_in_account_currency": self.received_amount, + "debit_in_transaction_currency": self.received_amount + if self.paid_to_account_currency == self.transaction_currency + else self.base_received_amount / self.transaction_exchange_rate, "debit": self.base_received_amount, "cost_center": self.cost_center, }, @@ -1537,6 +1566,8 @@ class PaymentEntry(AccountsController): dr_or_cr + "_in_account_currency": base_tax_amount if account_currency == self.company_currency else d.tax_amount, + dr_or_cr + "_in_transaction_currency": base_tax_amount + / self.transaction_exchange_rate, "cost_center": d.cost_center, "post_net_value": True, }, @@ -1562,6 +1593,8 @@ class PaymentEntry(AccountsController): rev_dr_or_cr + "_in_account_currency": base_tax_amount if account_currency == self.company_currency else d.tax_amount, + rev_dr_or_cr + "_in_transaction_currency": base_tax_amount + / self.transaction_exchange_rate, "cost_center": self.cost_center, "post_net_value": True, }, @@ -1584,6 +1617,7 @@ class PaymentEntry(AccountsController): "account_currency": account_currency, "against": self.party or self.paid_from, "debit_in_account_currency": d.amount, + "debit_in_transaction_currency": d.amount / self.transaction_exchange_rate, "debit": d.amount, "cost_center": d.cost_center, }, From 8b6eea63492c82e8bcddaf60b9cb85967c031d4c Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 6 Mar 2025 11:35:18 +0530 Subject: [PATCH 78/94] refactor: set transaction currency and rate before gl map (cherry picked from commit ceca5b4c72e60bf923bf8c85c7d7be0a15e6f9fc) --- .../accounts/doctype/payment_entry/payment_entry.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py index 588be1df4bf..5c9f855ea5b 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -1217,10 +1217,7 @@ class PaymentEntry(AccountsController): self.set("remarks", "\n".join(remarks)) - def build_gl_map(self): - if self.payment_type in ("Receive", "Pay") and not self.get("party_account_field"): - self.setup_party_account_field() - + def set_transaction_currency_and_rate(self): company_currency = erpnext.get_company_currency(self.company) self.transaction_currency = company_currency self.transaction_exchange_rate = 1 @@ -1232,6 +1229,11 @@ class PaymentEntry(AccountsController): self.transaction_currency = self.paid_to_account_currency self.transaction_exchange_rate = self.target_exchange_rate + def build_gl_map(self): + if self.payment_type in ("Receive", "Pay") and not self.get("party_account_field"): + self.setup_party_account_field() + self.set_transaction_currency_and_rate() + gl_entries = [] self.add_party_gl_entries(gl_entries) self.add_bank_gl_entries(gl_entries) @@ -1376,6 +1378,7 @@ class PaymentEntry(AccountsController): def make_advance_gl_entries( self, entry: object | dict = None, cancel: bool = 0, update_outstanding: str = "Yes" ): + self.set_transaction_currency_and_rate() gl_entries = [] self.add_advance_gl_entries(gl_entries, entry) From 3015628519a0aa1a8e4c76740b98bd94767b1947 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 6 Mar 2025 14:38:18 +0530 Subject: [PATCH 79/94] fix(test): incorrect transaction exchange rate in test case (cherry picked from commit a31770d12282771969feba8c54f2e79a2290e590) --- erpnext/accounts/doctype/journal_entry/test_journal_entry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/journal_entry/test_journal_entry.py b/erpnext/accounts/doctype/journal_entry/test_journal_entry.py index 54aa3eaf96f..0fef3a84372 100644 --- a/erpnext/accounts/doctype/journal_entry/test_journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/test_journal_entry.py @@ -575,7 +575,7 @@ class TestJournalEntry(unittest.TestCase): order_by="account", ) expected = [ - {"account": "_Test Bank - _TC", "transaction_exchange_rate": 1.0}, + {"account": "_Test Bank - _TC", "transaction_exchange_rate": 85.0}, {"account": "_Test Receivable USD - _TC", "transaction_exchange_rate": 85.0}, ] self.assertEqual(expected, actual) From af45ec0d6dd726e9cc7d26afe8644230a8704c55 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 6 Mar 2025 14:54:20 +0530 Subject: [PATCH 80/94] refactor(test): save first to let the tax table populate (cherry picked from commit 23d465805b8812e7f76ef5031f08fe9a49243b36) --- .../tax_withholding_category/test_tax_withholding_category.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py b/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py index 6ab6bcc08a2..ae0a098137a 100644 --- a/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py +++ b/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py @@ -519,7 +519,7 @@ class TestTaxWithholdingCategory(FrappeTestCase): payment = get_payment_entry(order.doctype, order.name) payment.apply_tax_withholding_amount = 1 payment.tax_withholding_category = "Cumulative Threshold TDS" - payment.submit() + payment.save().submit() self.assertEqual(payment.taxes[0].tax_amount, 4000) def test_multi_category_single_supplier(self): From 501e3881868b7f55598d9532c09bce635efe3049 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 6 Mar 2025 15:54:14 +0530 Subject: [PATCH 81/94] refactor: isolate to specific doctypes (cherry picked from commit b348aa3b3716838b1f00f5a8266c8d9b6904a660) --- erpnext/controllers/accounts_controller.py | 27 +++++++++++----------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 702445a29c5..b694e2cf9f4 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -1119,20 +1119,19 @@ class AccountsController(TransactionBase): ) # Update details in transaction currency - gl_dict.update( - { - "transaction_currency": self.get("currency") or self.company_currency, - "transaction_exchange_rate": item.get("exchange_rate", 1) - if self.doctype == "Journal Entry" and item - else self.get("conversion_rate", 1), - "debit_in_transaction_currency": self.get_value_in_transaction_currency( - account_currency, gl_dict, "debit" - ), - "credit_in_transaction_currency": self.get_value_in_transaction_currency( - account_currency, gl_dict, "credit" - ), - } - ) + if self.doctype not in ["Purchase Invoice", "Sales Invoice", "Journal Entry", "Payment Entry"]: + gl_dict.update( + { + "transaction_currency": self.get("currency") or self.company_currency, + "transaction_exchange_rate": self.get("conversion_rate", 1), + "debit_in_transaction_currency": self.get_value_in_transaction_currency( + account_currency, gl_dict, "debit" + ), + "credit_in_transaction_currency": self.get_value_in_transaction_currency( + account_currency, gl_dict, "credit" + ), + } + ) if not args.get("against_voucher_type") and self.get("against_voucher_type"): gl_dict.update({"against_voucher_type": self.get("against_voucher_type")}) From c479998cd68d1b61fe5a36d53f3dd5a083b00176 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 7 Mar 2025 11:40:14 +0530 Subject: [PATCH 82/94] chore: typo (cherry picked from commit bc792c61e9dc07c9ebef4534e9e1e7904adb592f) --- erpnext/accounts/doctype/journal_entry/journal_entry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index 725364c1590..113b1a96e2c 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -1064,7 +1064,7 @@ class JournalEntry(AccountsController): if self.multi_currency: for row in self.get("accounts"): if row.account_currency != company_currency: - # Journal assumes the first foregin currency as transaction currency + # Journal assumes the first foreign currency as transaction currency self.transaction_currency = row.account_currency self.transaction_exchange_rate = row.exchange_rate break From 3bdd4ce116cce56b95edc777e15bccb1c25ebbda Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 7 Mar 2025 13:22:08 +0530 Subject: [PATCH 83/94] fix: incorrect category in list (cherry picked from commit 6545467aecac894701b2e62719083d3db195a241) --- erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index 5d12066757e..c514f379406 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -953,7 +953,7 @@ class PurchaseInvoice(BuyingController): valuation_tax_accounts = [ d.account_head for d in self.get("taxes") - if d.category in ("Valuation", "Total and Valuation") + if d.category in ("Valuation", "Valuation and Total") and flt(d.base_tax_amount_after_discount_amount) ] From cacb720556624fd24c8fcb60c906411913726c8b Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 7 Mar 2025 13:22:20 +0530 Subject: [PATCH 84/94] refactor: convert tax amount using exchange rate (cherry picked from commit 7528ef147a0375dc863f2d4d0720f02dbcd71631) --- erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index c514f379406..9d19109217d 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -1195,7 +1195,8 @@ class PurchaseInvoice(BuyingController): "account": stock_rbnb, "against": self.supplier, "debit": flt(item.item_tax_amount, item.precision("item_tax_amount")), - "debit_in_transaction_currency": item.net_amount, + "debit_in_transaction_currency": item.item_tax_amount + / self.conversion_rate, "remarks": self.remarks or _("Accounting Entry for Stock"), "cost_center": self.cost_center, "project": item.project or self.project, From 2d290b153d9558e1fa57807907255b92904f79f8 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 7 Mar 2025 14:43:48 +0530 Subject: [PATCH 85/94] refactor: trx currency dr and cr for tax rows and item rows (cherry picked from commit 4cd3f3531c965c318c635ebe2600240c9f9782fd) --- .../purchase_invoice/purchase_invoice.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index 9d19109217d..146b2f5b210 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -1047,7 +1047,10 @@ class PurchaseInvoice(BuyingController): "account": item.expense_account, "against": self.supplier, "debit": warehouse_debit_amount, - "debit_in_transaction_currency": item.net_amount, + "debit_in_transaction_currency": flt( + warehouse_debit_amount / self.conversion_rate, + item.precision("net_amount"), + ), "remarks": self.get("remarks") or _("Accounting Entry for Stock"), "cost_center": item.cost_center, "project": item.project or self.project, @@ -1195,8 +1198,10 @@ class PurchaseInvoice(BuyingController): "account": stock_rbnb, "against": self.supplier, "debit": flt(item.item_tax_amount, item.precision("item_tax_amount")), - "debit_in_transaction_currency": item.item_tax_amount - / self.conversion_rate, + "debit_in_transaction_currency": flt( + item.item_tax_amount / self.conversion_rate, + item.precision("item_tax_amount"), + ), "remarks": self.remarks or _("Accounting Entry for Stock"), "cost_center": self.cost_center, "project": item.project or self.project, @@ -1393,6 +1398,10 @@ class PurchaseInvoice(BuyingController): "cost_center": tax.cost_center, "against": self.supplier, "credit": applicable_amount, + "credit_in_transaction_currency": flt( + applicable_amount / self.conversion_rate, + frappe.get_precision("Purchase Invoice Item", "item_tax_amount"), + ), "remarks": self.remarks or _("Accounting Entry for Stock"), }, item=tax, @@ -1411,6 +1420,10 @@ class PurchaseInvoice(BuyingController): "cost_center": tax.cost_center, "against": self.supplier, "credit": valuation_tax[tax.name], + "credit_in_transaction_currency": flt( + valuation_tax[tax.name] / self.conversion_rate, + frappe.get_precision("Purchase Invoice Item", "item_tax_amount"), + ), "remarks": self.remarks or _("Accounting Entry for Stock"), }, item=tax, From 61880a311aa6d1b8d1d5b01e105e006ff2f7e5e9 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 7 Mar 2025 17:00:21 +0530 Subject: [PATCH 86/94] refactor: handle rounding diff for trx currency dr and cr (cherry picked from commit 455a55b2ce5dddfc534efae8efb4b58fb50b949e) --- erpnext/accounts/general_ledger.py | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/erpnext/accounts/general_ledger.py b/erpnext/accounts/general_ledger.py index 7d0bf2cca11..cb267972c70 100644 --- a/erpnext/accounts/general_ledger.py +++ b/erpnext/accounts/general_ledger.py @@ -430,7 +430,7 @@ def process_debit_credit_difference(gl_map): voucher_no = gl_map[0].voucher_no allowance = get_debit_credit_allowance(voucher_type, precision) - debit_credit_diff = get_debit_credit_difference(gl_map, precision) + debit_credit_diff, trx_cur_debit_credit_diff = get_debit_credit_difference(gl_map, precision) if abs(debit_credit_diff) > allowance: if not ( @@ -441,9 +441,9 @@ def process_debit_credit_difference(gl_map): raise_debit_credit_not_equal_error(debit_credit_diff, voucher_type, voucher_no) elif abs(debit_credit_diff) >= (1.0 / (10**precision)): - make_round_off_gle(gl_map, debit_credit_diff, precision) + make_round_off_gle(gl_map, debit_credit_diff, trx_cur_debit_credit_diff, precision) - debit_credit_diff = get_debit_credit_difference(gl_map, precision) + debit_credit_diff, trx_cur_debit_credit_diff = get_debit_credit_difference(gl_map, precision) if abs(debit_credit_diff) > allowance: if not ( voucher_type == "Journal Entry" @@ -455,14 +455,23 @@ def process_debit_credit_difference(gl_map): def get_debit_credit_difference(gl_map, precision): debit_credit_diff = 0.0 + trx_cur_debit_credit_diff = 0 + for entry in gl_map: entry.debit = flt(entry.debit, precision) entry.credit = flt(entry.credit, precision) debit_credit_diff += entry.debit - entry.credit - debit_credit_diff = flt(debit_credit_diff, precision) + entry.debit_in_transaction_currency = flt(entry.debit_in_transaction_currency, precision) + entry.credit_in_transaction_currency = flt(entry.credit_in_transaction_currency, precision) + trx_cur_debit_credit_diff += ( + entry.debit_in_transaction_currency - entry.credit_in_transaction_currency + ) - return debit_credit_diff + debit_credit_diff = flt(debit_credit_diff, precision) + trx_cur_debit_credit_diff = flt(trx_cur_debit_credit_diff, precision) + + return debit_credit_diff, trx_cur_debit_credit_diff def get_debit_credit_allowance(voucher_type, precision): @@ -489,7 +498,7 @@ def has_opening_entries(gl_map: list) -> bool: return False -def make_round_off_gle(gl_map, debit_credit_diff, precision): +def make_round_off_gle(gl_map, debit_credit_diff, trx_cur_debit_credit_diff, precision): round_off_account, round_off_cost_center, round_off_for_opening = get_round_off_account_and_cost_center( gl_map[0].company, gl_map[0].voucher_type, gl_map[0].voucher_no ) @@ -534,6 +543,12 @@ def make_round_off_gle(gl_map, debit_credit_diff, precision): "credit_in_account_currency": debit_credit_diff if debit_credit_diff > 0 else 0, "debit": abs(debit_credit_diff) if debit_credit_diff < 0 else 0, "credit": debit_credit_diff if debit_credit_diff > 0 else 0, + "debit_in_transaction_currency": abs(trx_cur_debit_credit_diff) + if trx_cur_debit_credit_diff < 0 + else 0, + "credit_in_transaction_currency": trx_cur_debit_credit_diff + if trx_cur_debit_credit_diff > 0 + else 0, "cost_center": round_off_cost_center, "party_type": None, "party": None, From a1cf27ec17b8b472c0c45a44abd65a4ad5302606 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 7 Mar 2025 17:39:21 +0530 Subject: [PATCH 87/94] test: assert total debit and credit for trx currency (cherry picked from commit 55d06361232baa64551c90db25d5231f7dd32320) --- .../purchase_invoice/test_purchase_invoice.py | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py index e2386122522..192f9cc81d2 100644 --- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py @@ -2639,6 +2639,36 @@ class TestPurchaseInvoice(FrappeTestCase, StockTestMixin): "Buying Settings", "bill_for_rejected_quantity_in_purchase_invoice", original_value ) + def test_trx_currency_debit_credit_for_high_precision(self): + exc_rate = 0.737517516 + pi = make_purchase_invoice( + currency="USD", conversion_rate=exc_rate, qty=1, rate=2000, do_not_save=True + ) + pi.supplier = "_Test Supplier USD" + pi.save().submit() + + expected = ( + ("_Test Account Cost for Goods Sold - _TC", 1475.04, 0.0, 2000.0, 0.0, "USD", exc_rate), + ("_Test Payable USD - _TC", 0.0, 1475.04, 0.0, 2000.0, "USD", exc_rate), + ) + + actual = frappe.db.get_all( + "GL Entry", + filters={"voucher_no": pi.name}, + fields=[ + "account", + "debit", + "credit", + "debit_in_transaction_currency", + "credit_in_transaction_currency", + "transaction_currency", + "transaction_exchange_rate", + ], + order_by="account", + as_list=1, + ) + self.assertEqual(actual, expected) + def set_advance_flag(company, flag, default_account): frappe.db.set_value( From cd1803a74d4fca0fead907c6b791ce1c54a61b0c Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Sat, 8 Mar 2025 11:45:12 +0530 Subject: [PATCH 88/94] refactor: internal transfer gl (cherry picked from commit f1d8feec15595e9529af91827d106e77c1c0354d) --- erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index 146b2f5b210..5092c365fef 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -1439,6 +1439,7 @@ class PurchaseInvoice(BuyingController): "account": self.unrealized_profit_loss_account, "against": self.supplier, "credit": flt(self.total_taxes_and_charges), + "credit_in_transaction_currency": flt(self.total_taxes_and_charges), "credit_in_account_currency": flt(self.base_total_taxes_and_charges), "cost_center": self.cost_center, }, From d0b14f19076946b9d9a42568f687587d734eb2d1 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Sat, 8 Mar 2025 12:28:49 +0530 Subject: [PATCH 89/94] chore: resolve conflict --- .../doctype/sales_invoice/sales_invoice.py | 41 +------------------ 1 file changed, 2 insertions(+), 39 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 6f1b3a69605..92902c78e8e 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -1572,6 +1572,7 @@ class SalesInvoice(SellingController): "debit_in_account_currency": flt(self.base_change_amount) if self.party_account_currency == self.company_currency else flt(self.change_amount), + "debit_in_transaction_currency": flt(self.change_amount), "against_voucher": self.return_against if cint(self.is_return) and self.return_against else self.name, @@ -1584,13 +1585,13 @@ class SalesInvoice(SellingController): ) ) -<<<<<<< HEAD gl_entries.append( self.get_gl_dict( { "account": self.account_for_change_amount, "against": self.customer, "credit": self.base_change_amount, + "credit_in_transaction_currency": self.change_amount, "cost_center": self.cost_center, }, item=self, @@ -1598,44 +1599,6 @@ class SalesInvoice(SellingController): ) else: frappe.throw(_("Select change amount account"), title=_("Mandatory Field")) -======= - if not self.account_for_change_amount: - frappe.throw(_("Please set Account for Change Amount"), title=_("Mandatory Field")) - - return [ - self.get_gl_dict( - { - "account": self.debit_to, - "party_type": "Customer", - "party": self.customer, - "against": self.account_for_change_amount, - "debit": flt(self.base_change_amount), - "debit_in_account_currency": flt(self.base_change_amount) - if self.party_account_currency == self.company_currency - else flt(self.change_amount), - "debit_in_transaction_currency": flt(self.change_amount), - "against_voucher": self.return_against - if cint(self.is_return) and self.return_against - else self.name, - "against_voucher_type": self.doctype, - "cost_center": self.cost_center, - "project": self.project, - }, - self.party_account_currency, - item=self, - ), - self.get_gl_dict( - { - "account": self.account_for_change_amount, - "against": self.customer, - "credit": self.base_change_amount, - "credit_in_transaction_currency": self.change_amount, - "cost_center": self.cost_center, - }, - item=self, - ), - ] ->>>>>>> 3e292ef2cb (refactor: set transaction currency dr/cr in sales invoice) def make_write_off_gl_entry(self, gl_entries): # write off entries, applicable if only pos From 2ce8299bc8c5dbcf99dea5997ae9000ab7645a6d Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Sat, 8 Mar 2025 07:42:44 +0000 Subject: [PATCH 90/94] chore(release): Bumped to Version 15.54.2 ## [15.54.2](https://github.com/frappe/erpnext/compare/v15.54.1...v15.54.2) (2025-03-08) ### Bug Fixes * incorrect category in list ([3bdd4ce](https://github.com/frappe/erpnext/commit/3bdd4ce116cce56b95edc777e15bccb1c25ebbda)) * **test:** incorrect transaction exchange rate in test case ([3015628](https://github.com/frappe/erpnext/commit/3015628519a0aa1a8e4c76740b98bd94767b1947)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 7e5036a5a0e..0fac6de7898 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.54.1" +__version__ = "15.54.2" def get_default_company(user=None): From 34f03d608ad329f33892e8739fa3143db4bd4149 Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Sat, 8 Mar 2025 11:31:33 +0530 Subject: [PATCH 91/94] fix: consider account freeze date in recalculate_amount_difference_field patch (cherry picked from commit 696f931678d955fcc6b87d689343b2900f7ba9ca) # Conflicts: # erpnext/patches/v15_0/recalculate_amount_difference_field.py (cherry picked from commit 8b67527900df9ea6279451bc887eef7d88ac4f60) --- .../v15_0/recalculate_amount_difference_field.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/erpnext/patches/v15_0/recalculate_amount_difference_field.py b/erpnext/patches/v15_0/recalculate_amount_difference_field.py index 7d3d957fe62..e4e1add6949 100644 --- a/erpnext/patches/v15_0/recalculate_amount_difference_field.py +++ b/erpnext/patches/v15_0/recalculate_amount_difference_field.py @@ -62,6 +62,7 @@ def execute(): ): posting_date = period_closing_voucher[0].period_end_date +<<<<<<< HEAD try: fiscal_year = get_fiscal_year(frappe.utils.datetime.date.today()) except Exception: @@ -69,6 +70,15 @@ def execute(): else: if fiscal_year and getdate(fiscal_year[1]) > getdate(posting_date): posting_date = fiscal_year[1] +======= + acc_frozen_upto = frappe.db.get_single_value("Accounts Settings", "acc_frozen_upto") + if acc_frozen_upto and getdate(acc_frozen_upto) > getdate(posting_date): + posting_date = acc_frozen_upto + + fiscal_year = get_fiscal_year(frappe.utils.datetime.date.today(), raise_on_missing=False) + if fiscal_year and getdate(fiscal_year[1]) > getdate(posting_date): + posting_date = fiscal_year[1] +>>>>>>> 696f931678 (fix: consider account freeze date in recalculate_amount_difference_field patch) query = query.where(parent.posting_date > posting_date) if result := query.run(as_dict=True): From a18721d21c9dd359721a13393e98bcbbff860d37 Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Sat, 8 Mar 2025 11:38:28 +0530 Subject: [PATCH 92/94] fix: consider stock freeze date in recalculate_amount_difference_field patch (cherry picked from commit cd7253278937f66f2c5b52bebc54f137b03068a7) (cherry picked from commit 8264d42cd9083f71752a303fded52d698d819c57) --- erpnext/patches/v15_0/recalculate_amount_difference_field.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/erpnext/patches/v15_0/recalculate_amount_difference_field.py b/erpnext/patches/v15_0/recalculate_amount_difference_field.py index e4e1add6949..0f8083d8b14 100644 --- a/erpnext/patches/v15_0/recalculate_amount_difference_field.py +++ b/erpnext/patches/v15_0/recalculate_amount_difference_field.py @@ -75,6 +75,10 @@ def execute(): if acc_frozen_upto and getdate(acc_frozen_upto) > getdate(posting_date): posting_date = acc_frozen_upto + stock_frozen_upto = frappe.db.get_single_value("Stock Settings", "stock_frozen_upto") + if stock_frozen_upto and getdate(stock_frozen_upto) > getdate(posting_date): + posting_date = stock_frozen_upto + fiscal_year = get_fiscal_year(frappe.utils.datetime.date.today(), raise_on_missing=False) if fiscal_year and getdate(fiscal_year[1]) > getdate(posting_date): posting_date = fiscal_year[1] From 2b4dfca3ffcf4d0e5103bc833abd8da2dc698432 Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Sat, 8 Mar 2025 22:22:12 +0530 Subject: [PATCH 93/94] chore: resolve conflicts (cherry picked from commit 985fb5dfdc2cae524b77694fc73859667907449b) --- .../recalculate_amount_difference_field.py | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/erpnext/patches/v15_0/recalculate_amount_difference_field.py b/erpnext/patches/v15_0/recalculate_amount_difference_field.py index 0f8083d8b14..2891ac16c44 100644 --- a/erpnext/patches/v15_0/recalculate_amount_difference_field.py +++ b/erpnext/patches/v15_0/recalculate_amount_difference_field.py @@ -62,15 +62,6 @@ def execute(): ): posting_date = period_closing_voucher[0].period_end_date -<<<<<<< HEAD - try: - fiscal_year = get_fiscal_year(frappe.utils.datetime.date.today()) - except Exception: - return - else: - if fiscal_year and getdate(fiscal_year[1]) > getdate(posting_date): - posting_date = fiscal_year[1] -======= acc_frozen_upto = frappe.db.get_single_value("Accounts Settings", "acc_frozen_upto") if acc_frozen_upto and getdate(acc_frozen_upto) > getdate(posting_date): posting_date = acc_frozen_upto @@ -79,10 +70,14 @@ def execute(): if stock_frozen_upto and getdate(stock_frozen_upto) > getdate(posting_date): posting_date = stock_frozen_upto - fiscal_year = get_fiscal_year(frappe.utils.datetime.date.today(), raise_on_missing=False) - if fiscal_year and getdate(fiscal_year[1]) > getdate(posting_date): - posting_date = fiscal_year[1] ->>>>>>> 696f931678 (fix: consider account freeze date in recalculate_amount_difference_field patch) + try: + fiscal_year = get_fiscal_year(frappe.utils.datetime.date.today()) + except Exception: + return + else: + if fiscal_year and getdate(fiscal_year[1]) > getdate(posting_date): + posting_date = fiscal_year[1] + query = query.where(parent.posting_date > posting_date) if result := query.run(as_dict=True): From 47429095a2bc48dc66e5fe091f804ca0dd78010c Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Sun, 9 Mar 2025 11:04:11 +0000 Subject: [PATCH 94/94] chore(release): Bumped to Version 15.54.3 ## [15.54.3](https://github.com/frappe/erpnext/compare/v15.54.2...v15.54.3) (2025-03-09) ### Bug Fixes * consider account freeze date in recalculate_amount_difference_field patch ([34f03d6](https://github.com/frappe/erpnext/commit/34f03d608ad329f33892e8739fa3143db4bd4149)) * consider stock freeze date in recalculate_amount_difference_field patch ([a18721d](https://github.com/frappe/erpnext/commit/a18721d21c9dd359721a13393e98bcbbff860d37)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 0fac6de7898..a48e84c7257 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from frappe.utils.user import is_website_user -__version__ = "15.54.2" +__version__ = "15.54.3" def get_default_company(user=None):