From 2b72d143ca2b21e96862d21606923f87402d481d Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Tue, 11 Jul 2023 12:51:51 +0000 Subject: [PATCH 01/15] chore(release): Bumped to Version 14.30.0 # [14.30.0](https://github.com/frappe/erpnext/compare/v14.29.2...v14.30.0) (2023-07-11) ### Bug Fixes * accepted warehouse and rejected warehouse can't be same ([5d77e3c](https://github.com/frappe/erpnext/commit/5d77e3ce05be0ca723c07c1897306f4a862efe4f)) * also check on_hold ([#35910](https://github.com/frappe/erpnext/issues/35910)) ([59b3277](https://github.com/frappe/erpnext/commit/59b3277696d834debaf273b97916d4ea60c51060)) * conflicts ([e55a264](https://github.com/frappe/erpnext/commit/e55a264e57afd2a9e4fa34fe8cc5f4b529bea9b2)) * conflicts ([79f9785](https://github.com/frappe/erpnext/commit/79f9785d151217381af0ad24a66f521123a483c7)) * conflicts ([a178e66](https://github.com/frappe/erpnext/commit/a178e6693c650bb2ad02e2addb52c1dfb46a62d1)) * conflicts ([6459c28](https://github.com/frappe/erpnext/commit/6459c28316f7917e1ad733193f2ab16a89f453ea)) * deferred accounting entries on accounts frozen ([#35978](https://github.com/frappe/erpnext/issues/35978)) ([573183c](https://github.com/frappe/erpnext/commit/573183cff562460ccc4d8598b3477d41f56fc877)) * Delivery Note return valuation ([296f312](https://github.com/frappe/erpnext/commit/296f312e7f0e9a292ab859233a8950f69cfa9ab4)) * German translations ([#35990](https://github.com/frappe/erpnext/issues/35990)) ([b7b864e](https://github.com/frappe/erpnext/commit/b7b864e68c14301d76ca01608c2d69ad951e3f72)) * incorrect status in MR created from PP (backport [#36085](https://github.com/frappe/erpnext/issues/36085)) ([#36086](https://github.com/frappe/erpnext/issues/36086)) ([6dc7a19](https://github.com/frappe/erpnext/commit/6dc7a192ab865396ecd5339561521a5936b026e5)) * incorrect TCS amount while customer has advance payment ([#35397](https://github.com/frappe/erpnext/issues/35397)) ([2a4bbf3](https://github.com/frappe/erpnext/commit/2a4bbf34b4a97f51e97978a10cff14d85117fcd4)) * labels and translations ([#35963](https://github.com/frappe/erpnext/issues/35963)) ([04b1d45](https://github.com/frappe/erpnext/commit/04b1d459eb5ff4ff94c13a0b9b14b8126dcde895)) * Opening balance in presentation currency in Trial Balance report ([#36036](https://github.com/frappe/erpnext/issues/36036)) ([39e38bf](https://github.com/frappe/erpnext/commit/39e38bf08318e7af60251dcf500560040ba2526b)) * payment entry `voucher_type` error ([#35779](https://github.com/frappe/erpnext/issues/35779)) ([f3af0b2](https://github.com/frappe/erpnext/commit/f3af0b2d2e604fcf2e5f03ee9f2a0c07db09f71f)) * **Payment Entry:** compare rounded amount ([#36011](https://github.com/frappe/erpnext/issues/36011)) ([d80b0aa](https://github.com/frappe/erpnext/commit/d80b0aa157be79eee966b5bbe9715c84fdc9e204)) * possible type error on ERR creation ([0569899](https://github.com/frappe/erpnext/commit/05698994995c61b3929d4770fde6b8cb1dea7d06)) * precision causing outstanding issue on partly paid invoices ([#36030](https://github.com/frappe/erpnext/issues/36030)) ([3e711e8](https://github.com/frappe/erpnext/commit/3e711e888dc223b60e563585f219fe37141de88a)) * Share ledger showing cancelled docs ([#35993](https://github.com/frappe/erpnext/issues/35993)) ([5102d0c](https://github.com/frappe/erpnext/commit/5102d0c3f7604cd7d9363ce502c49c7122a50dc4)) * Validate for missing expense account ([#36078](https://github.com/frappe/erpnext/issues/36078)) ([f4f886c](https://github.com/frappe/erpnext/commit/f4f886c7d1745812e88279c86a056f6e8ce22a94)) * Vietnamese translation of "Company" ([#35887](https://github.com/frappe/erpnext/issues/35887)) ([e443e6c](https://github.com/frappe/erpnext/commit/e443e6c02a9e1ffa71a096046dcb2004c4797124)) ### Features * Closing balance for period closing and reporting ([#34257](https://github.com/frappe/erpnext/issues/34257)) ([ebf3c01](https://github.com/frappe/erpnext/commit/ebf3c0173e0b43705f0d9a3e2a30d66f61ca44aa)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 71544723f73..d390add326e 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.29.2" +__version__ = "14.30.0" def get_default_company(user=None): From 026c6085cc4bac59002bd8a8c2305c44f566e5fe Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 11 Jul 2023 17:51:27 +0530 Subject: [PATCH 02/15] fix: circular dependency during reposting causing timeout error (cherry picked from commit c16a5814d41610136ce00e5aca4269ea3d308971) (cherry picked from commit 2c21404813719a666c443964aa3583d2ad731538) --- .../purchase_receipt/test_purchase_receipt.py | 32 +++++++++++++++++++ erpnext/stock/stock_ledger.py | 20 ++++++++++-- 2 files changed, 49 insertions(+), 3 deletions(-) diff --git a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py index c87b3587fec..585871cf391 100644 --- a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py @@ -1908,6 +1908,32 @@ class TestPurchaseReceipt(FrappeTestCase): ste5.reload() self.assertEqual(ste5.items[0].valuation_rate, 275.00) + ste6 = make_stock_entry( + purpose="Material Transfer", + posting_date=add_days(today(), -3), + source=warehouse1, + target=warehouse, + item_code=item_code, + qty=20, + company=pr.company, + ) + + ste6.reload() + self.assertEqual(ste6.items[0].valuation_rate, 275.00) + + ste7 = make_stock_entry( + purpose="Material Transfer", + posting_date=add_days(today(), -3), + source=warehouse, + target=warehouse1, + item_code=item_code, + qty=20, + company=pr.company, + ) + + ste7.reload() + self.assertEqual(ste7.items[0].valuation_rate, 275.00) + create_landed_cost_voucher("Purchase Receipt", pr.name, pr.company, charges=2500 * -1) pr.reload() @@ -1928,6 +1954,12 @@ class TestPurchaseReceipt(FrappeTestCase): ste5.reload() self.assertEqual(ste5.items[0].valuation_rate, valuation_rate) + ste6.reload() + self.assertEqual(ste6.items[0].valuation_rate, valuation_rate) + + ste7.reload() + self.assertEqual(ste7.items[0].valuation_rate, valuation_rate) + def prepare_data_for_internal_transfer(): from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_internal_supplier diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py index e0de9913f08..7e6d3edae10 100644 --- a/erpnext/stock/stock_ledger.py +++ b/erpnext/stock/stock_ledger.py @@ -512,7 +512,7 @@ class update_entries_after(object): def update_distinct_item_warehouses(self, dependant_sle): key = (dependant_sle.item_code, dependant_sle.warehouse) - val = frappe._dict({"sle": dependant_sle}) + val = frappe._dict({"sle": dependant_sle, "dependent_voucher_detail_nos": []}) if key not in self.distinct_item_warehouses: self.distinct_item_warehouses[key] = val @@ -521,13 +521,26 @@ class update_entries_after(object): existing_sle_posting_date = ( self.distinct_item_warehouses[key].get("sle", {}).get("posting_date") ) + + dependent_voucher_detail_nos = self.get_dependent_voucher_detail_nos(key) + if getdate(dependant_sle.posting_date) < getdate(existing_sle_posting_date): val.sle_changed = True self.distinct_item_warehouses[key] = val self.new_items_found = True - elif self.distinct_item_warehouses[key].get("reposting_status"): - self.distinct_item_warehouses[key] = val + elif dependant_sle.voucher_detail_no not in set(dependent_voucher_detail_nos): + # Future dependent voucher needs to be repost to get the correct stock value + # If dependent voucher has not reposted, then add it to the list + dependent_voucher_detail_nos.append(dependant_sle.voucher_detail_no) self.new_items_found = True + val.dependent_voucher_detail_nos = dependent_voucher_detail_nos + self.distinct_item_warehouses[key] = val + + def get_dependent_voucher_detail_nos(self, key): + if "dependent_voucher_detail_nos" not in self.distinct_item_warehouses[key]: + self.distinct_item_warehouses[key].dependent_voucher_detail_nos = [] + + return self.distinct_item_warehouses[key].dependent_voucher_detail_nos def process_sle(self, sle): from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos @@ -1263,6 +1276,7 @@ def get_sle_by_voucher_detail_no(voucher_detail_no, excluded_sle=None): "qty_after_transaction", "posting_date", "posting_time", + "voucher_detail_no", "timestamp(posting_date, posting_time) as timestamp", ], as_dict=1, From d43cf0eca4ce2ad50317dda82e6b9a711be1a06c Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Tue, 11 Jul 2023 14:13:02 +0000 Subject: [PATCH 03/15] chore(release): Bumped to Version 14.30.1 ## [14.30.1](https://github.com/frappe/erpnext/compare/v14.30.0...v14.30.1) (2023-07-11) ### Bug Fixes * circular dependency during reposting causing timeout error ([026c608](https://github.com/frappe/erpnext/commit/026c6085cc4bac59002bd8a8c2305c44f566e5fe)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index d390add326e..20b19716421 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.30.0" +__version__ = "14.30.1" def get_default_company(user=None): From 49f28b0dbbaaad97f80f74921b8d80e22f39e159 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 13 Jul 2023 16:17:04 +0530 Subject: [PATCH 04/15] fix: Accounts closing balance patch (#36113) fix: Accounts closing balance patch (#36113) fix: Accounts closing balance patch (#36113) (cherry picked from commit d631c7dffaab22709cfbeaf6d306a9eba3c2a4ca) Co-authored-by: Deepesh Garg (cherry picked from commit cf29156139b56f3aaf72d45095e82a4329348c5e) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- erpnext/patches/v14_0/update_closing_balances.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/erpnext/patches/v14_0/update_closing_balances.py b/erpnext/patches/v14_0/update_closing_balances.py index d66467775c8..9a814f3ee4f 100644 --- a/erpnext/patches/v14_0/update_closing_balances.py +++ b/erpnext/patches/v14_0/update_closing_balances.py @@ -62,7 +62,10 @@ def execute(): entry["closing_date"] = pcv_doc.posting_date entry["period_closing_voucher"] = pcv_doc.name - make_closing_entries(gl_entries + closing_entries, voucher_name=pcv.name) + entries = gl_entries + closing_entries + if entries: + make_closing_entries(entries, voucher_name=pcv.name) + company_wise_order[pcv.company].append(pcv.posting_date) i += 1 From 1d9c28ec5e0446bead336c068af6f99581b20889 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Thu, 13 Jul 2023 10:52:30 +0000 Subject: [PATCH 05/15] chore(release): Bumped to Version 14.30.2 ## [14.30.2](https://github.com/frappe/erpnext/compare/v14.30.1...v14.30.2) (2023-07-13) ### Bug Fixes * Accounts closing balance patch ([#36113](https://github.com/frappe/erpnext/issues/36113)) ([49f28b0](https://github.com/frappe/erpnext/commit/49f28b0dbbaaad97f80f74921b8d80e22f39e159)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 20b19716421..699dd3fd843 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.30.1" +__version__ = "14.30.2" def get_default_company(user=None): From 495a8a9ce13ed6da8ebf65932b7d14f818b8304a Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 14 Jul 2023 11:21:59 +0530 Subject: [PATCH 06/15] fix: Account balance patch and query fixes (#36117) fix: Account balance patch and query fixes (#36117) (cherry picked from commit b4bd978791166e24b126683fc2f9dde8eadb4341) # Conflicts: # erpnext/patches.txt * chore: resolve conflicts --------- Co-authored-by: Deepesh Garg (cherry picked from commit 0147754273c726d6e64b283231c3cc3c0a83287e) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- .../report/trial_balance/trial_balance.py | 7 +- erpnext/patches.txt | 2 +- .../patches/v14_0/update_closing_balances.py | 101 +++++++++--------- 3 files changed, 59 insertions(+), 51 deletions(-) diff --git a/erpnext/accounts/report/trial_balance/trial_balance.py b/erpnext/accounts/report/trial_balance/trial_balance.py index d51c4c4acba..7a8b7dc5819 100644 --- a/erpnext/accounts/report/trial_balance/trial_balance.py +++ b/erpnext/accounts/report/trial_balance/trial_balance.py @@ -159,6 +159,8 @@ def get_rootwise_opening_balances(filters, report_type): accounting_dimensions, period_closing_voucher=last_period_closing_voucher[0].name, ) + + # Report getting generate from the mid of a fiscal year if getdate(last_period_closing_voucher[0].posting_date) < getdate( add_days(filters.from_date, -1) ): @@ -220,7 +222,10 @@ def get_opening_balance( if start_date: opening_balance = opening_balance.where(closing_balance.posting_date >= start_date) opening_balance = opening_balance.where(closing_balance.is_opening == "No") - opening_balance = opening_balance.where(closing_balance.posting_date < filters.from_date) + else: + opening_balance = opening_balance.where( + (closing_balance.posting_date < filters.from_date) | (closing_balance.is_opening == "Yes") + ) if ( not filters.show_unclosed_fy_pl_balances diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 337e9c79a61..2e8b26ff475 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -336,4 +336,4 @@ erpnext.patches.v14_0.cleanup_workspaces erpnext.patches.v14_0.enable_allow_existing_serial_no erpnext.patches.v14_0.set_report_in_process_SOA erpnext.patches.v14_0.create_accounting_dimensions_for_closing_balance -erpnext.patches.v14_0.update_closing_balances +erpnext.patches.v14_0.update_closing_balances #14-07-2023 diff --git a/erpnext/patches/v14_0/update_closing_balances.py b/erpnext/patches/v14_0/update_closing_balances.py index 9a814f3ee4f..8849c11fcac 100644 --- a/erpnext/patches/v14_0/update_closing_balances.py +++ b/erpnext/patches/v14_0/update_closing_balances.py @@ -13,59 +13,62 @@ from erpnext.accounts.utils import get_fiscal_year def execute(): frappe.db.truncate("Account Closing Balance") - i = 0 - company_wise_order = {} - for pcv in frappe.db.get_all( - "Period Closing Voucher", - fields=["company", "posting_date", "name"], - filters={"docstatus": 1}, - order_by="posting_date", - ): + for company in frappe.get_all("Company", pluck="name"): + i = 0 + company_wise_order = {} + for pcv in frappe.db.get_all( + "Period Closing Voucher", + fields=["company", "posting_date", "name"], + filters={"docstatus": 1, "company": company}, + order_by="posting_date", + ): - company_wise_order.setdefault(pcv.company, []) - if pcv.posting_date not in company_wise_order[pcv.company]: - pcv_doc = frappe.get_doc("Period Closing Voucher", pcv.name) - pcv_doc.year_start_date = get_fiscal_year( - pcv.posting_date, pcv.fiscal_year, company=pcv.company - )[1] + company_wise_order.setdefault(pcv.company, []) + if pcv.posting_date not in company_wise_order[pcv.company]: + pcv_doc = frappe.get_doc("Period Closing Voucher", pcv.name) + pcv_doc.year_start_date = get_fiscal_year( + pcv.posting_date, pcv.fiscal_year, company=pcv.company + )[1] - # get gl entries against pcv - gl_entries = frappe.db.get_all( - "GL Entry", filters={"voucher_no": pcv.name, "is_cancelled": 0}, fields=["*"] - ) - for entry in gl_entries: - entry["is_period_closing_voucher_entry"] = 1 - entry["closing_date"] = pcv_doc.posting_date - entry["period_closing_voucher"] = pcv_doc.name - - # get all gl entries for the year - closing_entries = frappe.db.get_all( - "GL Entry", - filters={ - "is_cancelled": 0, - "voucher_no": ["!=", pcv.name], - "posting_date": ["between", [pcv_doc.year_start_date, pcv.posting_date]], - "is_opening": "No", - }, - fields=["*"], - ) - - if i == 0: - # add opening entries only for the first pcv - closing_entries += frappe.db.get_all( - "GL Entry", - filters={"is_cancelled": 0, "is_opening": "Yes"}, - fields=["*"], + # get gl entries against pcv + gl_entries = frappe.db.get_all( + "GL Entry", filters={"voucher_no": pcv.name, "is_cancelled": 0}, fields=["*"] ) + for entry in gl_entries: + entry["is_period_closing_voucher_entry"] = 1 + entry["closing_date"] = pcv_doc.posting_date + entry["period_closing_voucher"] = pcv_doc.name - for entry in closing_entries: - entry["closing_date"] = pcv_doc.posting_date - entry["period_closing_voucher"] = pcv_doc.name + closing_entries = [] - entries = gl_entries + closing_entries - if entries: - make_closing_entries(entries, voucher_name=pcv.name) + if pcv.posting_date not in company_wise_order[pcv.company]: + # get all gl entries for the year + closing_entries = frappe.db.get_all( + "GL Entry", + filters={ + "is_cancelled": 0, + "voucher_no": ["!=", pcv.name], + "posting_date": ["between", [pcv_doc.year_start_date, pcv.posting_date]], + "is_opening": "No", + }, + fields=["*"], + ) - company_wise_order[pcv.company].append(pcv.posting_date) + if i == 0: + # add opening entries only for the first pcv + closing_entries += frappe.db.get_all( + "GL Entry", + filters={"is_cancelled": 0, "is_opening": "Yes"}, + fields=["*"], + ) - i += 1 + for entry in closing_entries: + entry["closing_date"] = pcv_doc.posting_date + entry["period_closing_voucher"] = pcv_doc.name + + entries = gl_entries + closing_entries + + if entries: + make_closing_entries(entries, voucher_name=pcv.name) + i += 1 + company_wise_order[pcv.company].append(pcv.posting_date) From 2f2b45bd6d9b722b83209f3eb70459e510776236 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Fri, 14 Jul 2023 05:53:54 +0000 Subject: [PATCH 07/15] chore(release): Bumped to Version 14.30.3 ## [14.30.3](https://github.com/frappe/erpnext/compare/v14.30.2...v14.30.3) (2023-07-14) ### Bug Fixes * Account balance patch and query fixes ([#36117](https://github.com/frappe/erpnext/issues/36117)) ([495a8a9](https://github.com/frappe/erpnext/commit/495a8a9ce13ed6da8ebf65932b7d14f818b8304a)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 699dd3fd843..5bf10ee1be8 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.30.2" +__version__ = "14.30.3" def get_default_company(user=None): From 43d6cc087eae8eccf4161378b27bfa4b410bb5b9 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 14 Jul 2023 16:02:32 +0530 Subject: [PATCH 08/15] fix: Handle multi-company in patch (#36127) fix: Handle multi-company in patch (#36127) * fix: Handle multi-company in patch (#36127) fix: Handle multi-compnay in patch (cherry picked from commit ac9ad8ec364fcf507357062db37355b18af66ba9) * chore: re trigger patch --------- Co-authored-by: Deepesh Garg (cherry picked from commit e7f57542ab26042521873d9a3a6b7135d1566a36) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- erpnext/patches.txt | 2 +- erpnext/patches/v14_0/update_closing_balances.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 2e8b26ff475..4b09e0c10f6 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -336,4 +336,4 @@ erpnext.patches.v14_0.cleanup_workspaces erpnext.patches.v14_0.enable_allow_existing_serial_no erpnext.patches.v14_0.set_report_in_process_SOA erpnext.patches.v14_0.create_accounting_dimensions_for_closing_balance -erpnext.patches.v14_0.update_closing_balances #14-07-2023 +erpnext.patches.v14_0.update_closing_balances #15-07-2023 diff --git a/erpnext/patches/v14_0/update_closing_balances.py b/erpnext/patches/v14_0/update_closing_balances.py index 8849c11fcac..2947b98740b 100644 --- a/erpnext/patches/v14_0/update_closing_balances.py +++ b/erpnext/patches/v14_0/update_closing_balances.py @@ -50,6 +50,7 @@ def execute(): "voucher_no": ["!=", pcv.name], "posting_date": ["between", [pcv_doc.year_start_date, pcv.posting_date]], "is_opening": "No", + "company": company, }, fields=["*"], ) @@ -58,7 +59,7 @@ def execute(): # add opening entries only for the first pcv closing_entries += frappe.db.get_all( "GL Entry", - filters={"is_cancelled": 0, "is_opening": "Yes"}, + filters={"is_cancelled": 0, "is_opening": "Yes", "company": company}, fields=["*"], ) From d420eeb8841cd8ae0c7d8ab0328b9fcd8727c11b Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Fri, 14 Jul 2023 10:43:22 +0000 Subject: [PATCH 09/15] chore(release): Bumped to Version 14.30.4 ## [14.30.4](https://github.com/frappe/erpnext/compare/v14.30.3...v14.30.4) (2023-07-14) ### Bug Fixes * Handle multi-company in patch ([#36127](https://github.com/frappe/erpnext/issues/36127)) ([43d6cc0](https://github.com/frappe/erpnext/commit/43d6cc087eae8eccf4161378b27bfa4b410bb5b9)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 5bf10ee1be8..ac872c4482f 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.30.3" +__version__ = "14.30.4" def get_default_company(user=None): From c3acdcf3accbda2dc3233202f29c839d9138b106 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 14 Jul 2023 18:10:16 +0530 Subject: [PATCH 10/15] fix: `TypeError` while creating WO from PP (backport #36136) (backport #36137) (#36138) fix: `TypeError` while creating WO from PP (backport #36136) (#36137) fix: `TypeError` while creating WO from PP (#36136) (cherry picked from commit 8f5b94f5fd6a7ba283f412cb644193264e6f15c7) Co-authored-by: s-aga-r (cherry picked from commit dd5101056dd6f54d13f981c608a80cf868ea2b15) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- .../manufacturing/doctype/production_plan/production_plan.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.py b/erpnext/manufacturing/doctype/production_plan/production_plan.py index 5f957a5442b..a988badd744 100644 --- a/erpnext/manufacturing/doctype/production_plan/production_plan.py +++ b/erpnext/manufacturing/doctype/production_plan/production_plan.py @@ -621,7 +621,7 @@ class ProductionPlan(Document): def create_work_order(self, item): from erpnext.manufacturing.doctype.work_order.work_order import OverProductionError - if item.get("qty") <= 0: + if flt(item.get("qty")) <= 0: return wo = frappe.new_doc("Work Order") From ed8217d3098ce254c4307a2ee3854c0e83a9b028 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Fri, 14 Jul 2023 12:50:49 +0000 Subject: [PATCH 11/15] chore(release): Bumped to Version 14.30.5 ## [14.30.5](https://github.com/frappe/erpnext/compare/v14.30.4...v14.30.5) (2023-07-14) ### Bug Fixes * `TypeError` while creating WO from PP (backport [#36136](https://github.com/frappe/erpnext/issues/36136)) (backport [#36137](https://github.com/frappe/erpnext/issues/36137)) ([#36138](https://github.com/frappe/erpnext/issues/36138)) ([c3acdcf](https://github.com/frappe/erpnext/commit/c3acdcf3accbda2dc3233202f29c839d9138b106)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index ac872c4482f..5950528be78 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.30.4" +__version__ = "14.30.5" def get_default_company(user=None): From 8e48c4ee3e6580f41f06e76cb07c8880a7aec507 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 14 Jul 2023 20:05:40 +0530 Subject: [PATCH 12/15] fix: Opening entries showing up incorrectly in TB report (#36135) fix: Opening entries showing up incorrectly in TB report (#36135) fix: Opening entries showing up incorrectly in TB report (#36135) * fix: Opening entries showing up incorrectly in TB report * chore: Linting Issue (cherry picked from commit 297c7e833c41c3e867a9bfb66e39f8dfe12eb2b6) Co-authored-by: Deepesh Garg (cherry picked from commit d10e5e666bef96b35af79c68d8e97ad9fb129d83) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- erpnext/accounts/report/financial_statements.py | 2 +- erpnext/accounts/report/trial_balance/trial_balance.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py index f3a892ba43c..db9609debe6 100644 --- a/erpnext/accounts/report/financial_statements.py +++ b/erpnext/accounts/report/financial_statements.py @@ -416,6 +416,7 @@ def set_gl_entries_by_account( filters, gl_entries_by_account, ignore_closing_entries=False, + ignore_opening_entries=False, ): """Returns a dict like { "account": [gl entries], ... }""" gl_entries = [] @@ -426,7 +427,6 @@ def set_gl_entries_by_account( pluck="name", ) - ignore_opening_entries = False if accounts_list: # For balance sheet if not from_date: diff --git a/erpnext/accounts/report/trial_balance/trial_balance.py b/erpnext/accounts/report/trial_balance/trial_balance.py index 7a8b7dc5819..5176c31be71 100644 --- a/erpnext/accounts/report/trial_balance/trial_balance.py +++ b/erpnext/accounts/report/trial_balance/trial_balance.py @@ -117,6 +117,7 @@ def get_data(filters): filters, gl_entries_by_account, ignore_closing_entries=not flt(filters.with_period_closing_entry), + ignore_opening_entries=True, ) calculate_values(accounts, gl_entries_by_account, opening_balances) From 9ec3087af8174bb0bd09f3ae1ed1504b3c3e7544 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Fri, 14 Jul 2023 14:37:01 +0000 Subject: [PATCH 13/15] chore(release): Bumped to Version 14.30.6 ## [14.30.6](https://github.com/frappe/erpnext/compare/v14.30.5...v14.30.6) (2023-07-14) ### Bug Fixes * Opening entries showing up incorrectly in TB report ([#36135](https://github.com/frappe/erpnext/issues/36135)) ([8e48c4e](https://github.com/frappe/erpnext/commit/8e48c4ee3e6580f41f06e76cb07c8880a7aec507)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 5950528be78..5f658c0c3be 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.30.5" +__version__ = "14.30.6" def get_default_company(user=None): From bcf7d87b611254eff393877b747e9d09245ab0db Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Mon, 17 Jul 2023 15:21:48 +0530 Subject: [PATCH 14/15] fix: incorrect Reserved Qty for Production Plan in BIN for multi-uom case (cherry picked from commit 2f632d031aa53e1e03763623449e7cde7dca3c55) --- .../production_plan/production_plan.py | 2 +- .../production_plan/test_production_plan.py | 48 +++++++++++++++++++ .../material_request/material_request.py | 12 +++-- 3 files changed, 58 insertions(+), 4 deletions(-) diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.py b/erpnext/manufacturing/doctype/production_plan/production_plan.py index a988badd744..d8cc8f6d395 100644 --- a/erpnext/manufacturing/doctype/production_plan/production_plan.py +++ b/erpnext/manufacturing/doctype/production_plan/production_plan.py @@ -1539,7 +1539,7 @@ def get_reserved_qty_for_production_plan(item_code, warehouse): frappe.qb.from_(table) .inner_join(child) .on(table.name == child.parent) - .select(Sum(child.required_bom_qty * IfNull(child.conversion_factor, 1.0))) + .select(Sum(child.quantity * IfNull(child.conversion_factor, 1.0))) .where( (table.docstatus == 1) & (child.item_code == item_code) diff --git a/erpnext/manufacturing/doctype/production_plan/test_production_plan.py b/erpnext/manufacturing/doctype/production_plan/test_production_plan.py index fcfba7fca56..f60dbfc3f55 100644 --- a/erpnext/manufacturing/doctype/production_plan/test_production_plan.py +++ b/erpnext/manufacturing/doctype/production_plan/test_production_plan.py @@ -933,6 +933,54 @@ class TestProductionPlan(FrappeTestCase): self.assertEqual(after_qty, before_qty) + def test_resered_qty_for_production_plan_for_material_requests_with_multi_UOM(self): + from erpnext.stock.utils import get_or_make_bin + + fg_item = make_item(properties={"is_stock_item": 1, "stock_uom": "_Test UOM 1"}).name + bom_item = make_item( + properties={"is_stock_item": 1, "stock_uom": "_Test UOM 1", "purchase_uom": "Nos"} + ).name + + if not frappe.db.exists("UOM Conversion Detail", {"parent": bom_item, "uom": "Nos"}): + doc = frappe.get_doc("Item", bom_item) + doc.append("uoms", {"uom": "Nos", "conversion_factor": 25}) + doc.save() + + make_bom(item=fg_item, raw_materials=[bom_item], source_warehouse="_Test Warehouse - _TC") + + bin_name = get_or_make_bin(bom_item, "_Test Warehouse - _TC") + before_qty = flt(frappe.db.get_value("Bin", bin_name, "reserved_qty_for_production_plan")) + + pln = create_production_plan( + item_code=fg_item, planned_qty=100, ignore_existing_ordered_qty=1, stock_uom="_Test UOM 1" + ) + + for row in pln.mr_items: + self.assertEqual(row.uom, "Nos") + self.assertEqual(row.quantity, 4) + + reserved_qty = flt(frappe.db.get_value("Bin", bin_name, "reserved_qty_for_production_plan")) + self.assertEqual(reserved_qty - before_qty, 100.0) + + pln.submit_material_request = 1 + pln.make_work_order() + + for work_order in frappe.get_all( + "Work Order", + fields=["name"], + filters={"production_plan": pln.name}, + ): + wo_doc = frappe.get_doc("Work Order", work_order.name) + wo_doc.source_warehouse = "_Test Warehouse - _TC" + wo_doc.wip_warehouse = "_Test Warehouse 1 - _TC" + wo_doc.fg_warehouse = "_Test Warehouse - _TC" + wo_doc.submit() + + reserved_qty_after_mr = flt( + frappe.db.get_value("Bin", bin_name, "reserved_qty_for_production_plan") + ) + self.assertEqual(reserved_qty_after_mr, before_qty) + def test_skip_available_qty_for_sub_assembly_items(self): from erpnext.manufacturing.doctype.bom.test_bom import create_nested_bom diff --git a/erpnext/stock/doctype/material_request/material_request.py b/erpnext/stock/doctype/material_request/material_request.py index 9576f409487..b430d03d92b 100644 --- a/erpnext/stock/doctype/material_request/material_request.py +++ b/erpnext/stock/doctype/material_request/material_request.py @@ -121,8 +121,8 @@ class MaterialRequest(BuyingController): self.title = _("{0} Request for {1}").format(self.material_request_type, items)[:100] def on_submit(self): - self.update_requested_qty() self.update_requested_qty_in_production_plan() + self.update_requested_qty() if self.material_request_type == "Purchase": self.validate_budget() @@ -181,8 +181,8 @@ class MaterialRequest(BuyingController): ) def on_cancel(self): - self.update_requested_qty() self.update_requested_qty_in_production_plan() + self.update_requested_qty() def get_mr_items_ordered_qty(self, mr_items): mr_items_ordered_qty = {} @@ -273,7 +273,13 @@ class MaterialRequest(BuyingController): item_wh_list.append([d.item_code, d.warehouse]) for item_code, warehouse in item_wh_list: - update_bin_qty(item_code, warehouse, {"indented_qty": get_indented_qty(item_code, warehouse)}) + update_bin_qty( + item_code, + warehouse, + { + "indented_qty": get_indented_qty(item_code, warehouse), + }, + ) def update_requested_qty_in_production_plan(self): production_plans = [] From cdd5f992f6072f52c51ba8ed77d25f5de50b9a1f Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Tue, 18 Jul 2023 09:46:15 +0000 Subject: [PATCH 15/15] chore(release): Bumped to Version 14.30.7 ## [14.30.7](https://github.com/frappe/erpnext/compare/v14.30.6...v14.30.7) (2023-07-18) ### Bug Fixes * incorrect Reserved Qty for Production Plan in BIN for multi-uom case ([bcf7d87](https://github.com/frappe/erpnext/commit/bcf7d87b611254eff393877b747e9d09245ab0db)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 5f658c0c3be..73dd306905a 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.30.6" +__version__ = "14.30.7" def get_default_company(user=None):