From b773465b419661953462c8689bf82b8680ddb93d Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 16 Aug 2023 06:34:09 +0000 Subject: [PATCH 01/20] chore(release): Bumped to Version 14.35.0 # [14.35.0](https://github.com/frappe/erpnext/compare/v14.34.3...v14.35.0) (2023-08-16) ### Bug Fixes * Allow backdated repayment cancels for term loans ([1377cf4](https://github.com/frappe/erpnext/commit/1377cf4cf1bfad982f91c0b65d3ffaf28ed24dd1)) * allow negative stock condition for batch item ([#36586](https://github.com/frappe/erpnext/issues/36586)) ([ee04c6d](https://github.com/frappe/erpnext/commit/ee04c6d5c52428f6f8e28fdf1a4e25075bee59ff)) * AR/AP report based on payment terms ([#36574](https://github.com/frappe/erpnext/issues/36574)) ([ac0fff7](https://github.com/frappe/erpnext/commit/ac0fff7e94598abac128c5ed7e2ed33de98b7be2)) * better remarks on Cr note created by Reconciliation ([5443592](https://github.com/frappe/erpnext/commit/5443592d84c180e27168afb624d43e36645f42f8)) * Button Alignment center in hero slider ([#36607](https://github.com/frappe/erpnext/issues/36607)) ([b131f70](https://github.com/frappe/erpnext/commit/b131f70ed6a8e3b763d59106084440e08a73b815)), closes [#36561](https://github.com/frappe/erpnext/issues/36561) * cr/dr note should be posted for exc gain/loss ([349601b](https://github.com/frappe/erpnext/commit/349601b4b971010cfc7d260c644c9ec7b95924a3)) * disallow mulitple SO with same PO No ([b901cfd](https://github.com/frappe/erpnext/commit/b901cfdbe25e53b80f53391560a58e6acfdc104c)) * don't show disabled items in `Item Shortage Report` (backport [#36550](https://github.com/frappe/erpnext/issues/36550)) ([#36571](https://github.com/frappe/erpnext/issues/36571)) ([19cfcea](https://github.com/frappe/erpnext/commit/19cfcea78efa065c4ab1daa23f71da240d1e0ec0)) * fetch `Stock UOM` from Item if not set (backport [#36606](https://github.com/frappe/erpnext/issues/36606)) ([#36617](https://github.com/frappe/erpnext/issues/36617)) ([8b13185](https://github.com/frappe/erpnext/commit/8b13185c25786afd05df0aa9dc56b2494450bc74)) * Group Account total not showing in Financial Statements ([2912648](https://github.com/frappe/erpnext/commit/291264815196fdbec70fcd667db760a9017bb40e)) * incorrect available qty for backdated stock reco with batch ([#36581](https://github.com/frappe/erpnext/issues/36581)) ([2800ad3](https://github.com/frappe/erpnext/commit/2800ad39d2adc40b932b4626a1be4df89916973c)) * incorrect gain/loss on allocation change on reconciliation tool ([39c439d](https://github.com/frappe/erpnext/commit/39c439dc4b8dc7f054644917141ecfd861656e12)) * Make default sales update frequency as monthly instead of each transaction ([4ca1f3b](https://github.com/frappe/erpnext/commit/4ca1f3b9cf69b00a80499b5d7d59a36a00521bf6)) * move company rename to long queue ([8083c0b](https://github.com/frappe/erpnext/commit/8083c0b59e3e371a39f18280edd092e985e5d0cd)) * precision issue while submitting the stock entry ([#36575](https://github.com/frappe/erpnext/issues/36575)) ([a864e07](https://github.com/frappe/erpnext/commit/a864e07d4ff2cf2d22754ad9d23a2a3718ece770)) * re-add permission that was unintentionally removed ([#36663](https://github.com/frappe/erpnext/issues/36663)) ([99777d3](https://github.com/frappe/erpnext/commit/99777d3fa40e6a3225a33321ede92da759312553)) * **RFQ:** link to supplier portal ([eb2f68e](https://github.com/frappe/erpnext/commit/eb2f68ec987151cc355312947dda4f9ea24e23fe)) * standard formula to calculate the "difference" ([#36612](https://github.com/frappe/erpnext/issues/36612)) ([716d5c0](https://github.com/frappe/erpnext/commit/716d5c0b98bee5dfcec02e1a84ab6b0343abc1ac)) * Tax withholding post LDC limit consumed ([#36611](https://github.com/frappe/erpnext/issues/36611)) ([1deebe8](https://github.com/frappe/erpnext/commit/1deebe87574115a563b99dd04442f1b599150e09)) * **test:** replace hardcoded reference to adv with dynamic one ([2e6bfa3](https://github.com/frappe/erpnext/commit/2e6bfa36de244e2944cd2ff6d42fff4e6ba3cbb8)) * **test:** test case breakage in Github Actions ([3542df7](https://github.com/frappe/erpnext/commit/3542df70f68e76cc9c7b806900b723b4258e5e94)) * unhide `uom` and `stock_uom` fields in print view ([b49309c](https://github.com/frappe/erpnext/commit/b49309c160fe20af7a7ee6fdccdc8e07382b4e76)) * validation blocks partial payment for SO and PO ([ce08f03](https://github.com/frappe/erpnext/commit/ce08f038d276782e58d82155b8122dd5423998dc)) * wrap none type rate under flt (backport [#36602](https://github.com/frappe/erpnext/issues/36602)) ([#36604](https://github.com/frappe/erpnext/issues/36604)) ([63c061e](https://github.com/frappe/erpnext/commit/63c061e5e823cb05c3fb2264c032bec7e90955a4)) * wrong currency on financial-statement based reports ([#36524](https://github.com/frappe/erpnext/issues/36524)) ([3044f46](https://github.com/frappe/erpnext/commit/3044f46c52a3ea7cf5bcbfb4abc88bc400aea4a4)) ### Features * add voucher totals in tds payable report ([#36568](https://github.com/frappe/erpnext/issues/36568)) ([90b390c](https://github.com/frappe/erpnext/commit/90b390c2c5554b779da4989e9d4475039681fa9b)) * daily asset depreciation method ([#36587](https://github.com/frappe/erpnext/issues/36587)) ([2918127](https://github.com/frappe/erpnext/commit/29181274c8591c3028d556e3ded2c6e210c6cf12)) * Reallow customizing company abbreviation on setup. ([#36646](https://github.com/frappe/erpnext/issues/36646)) ([ca34b63](https://github.com/frappe/erpnext/commit/ca34b63470283360dda1a6ac05ec5bd88ed9533c)) ### Performance Improvements * **invoice:** Faster return amount query (backport [#36556](https://github.com/frappe/erpnext/issues/36556)) ([#36557](https://github.com/frappe/erpnext/issues/36557)) ([fe41be9](https://github.com/frappe/erpnext/commit/fe41be953d301b3a92680b5d8eaa04fb5f8a4d95)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 24573a20c12..1aab20134b7 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.34.3" +__version__ = "14.35.0" def get_default_company(user=None): From 641fe7738c59bcfe275eaed7020363a90b0896a3 Mon Sep 17 00:00:00 2001 From: Dany Robert Date: Thu, 17 Aug 2023 18:01:15 +0530 Subject: [PATCH 02/20] fix(ux): change batch selection message to alert (#36500) * fix(ux): change batch selection message to alert * chore: linters --- erpnext/stock/doctype/batch/batch.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/batch/batch.py b/erpnext/stock/doctype/batch/batch.py index 1843c6e7975..f377f94a8cf 100644 --- a/erpnext/stock/doctype/batch/batch.py +++ b/erpnext/stock/doctype/batch/batch.py @@ -297,7 +297,9 @@ def get_batch_no(item_code, warehouse, qty=1, throw=False, serial_no=None): frappe.msgprint( _( "Please select a Batch for Item {0}. Unable to find a single batch that fulfills this requirement" - ).format(frappe.bold(item_code)) + ).format(frappe.bold(item_code)), + indicator="yellow", + alert=(not throw), ) if throw: raise UnableToSelectBatchError From 2aa3b30b56801168b0082a98a5f2cd4a0e818b38 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Thu, 17 Aug 2023 12:32:49 +0000 Subject: [PATCH 03/20] chore(release): Bumped to Version 14.35.1 ## [14.35.1](https://github.com/frappe/erpnext/compare/v14.35.0...v14.35.1) (2023-08-17) ### Bug Fixes * **ux:** change batch selection message to alert ([#36500](https://github.com/frappe/erpnext/issues/36500)) ([641fe77](https://github.com/frappe/erpnext/commit/641fe7738c59bcfe275eaed7020363a90b0896a3)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 1aab20134b7..8d4340c59de 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.35.0" +__version__ = "14.35.1" def get_default_company(user=None): From d5a596dff117522b5986a0509d0f16ca279d0e9b Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 18 Aug 2023 20:59:20 +0530 Subject: [PATCH 04/20] fix: timeout error coming during reposting (backport #36715) (#36716) fix: timeout error coming during reposting (#36715) (cherry picked from commit 620b21fec59e40178fde96085003d419804f21e0) Co-authored-by: rohitwaghchaure --- erpnext/stock/stock_ledger.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py index d8284af6047..8cd6325c9d3 100644 --- a/erpnext/stock/stock_ledger.py +++ b/erpnext/stock/stock_ledger.py @@ -521,7 +521,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, "dependent_voucher_detail_nos": []}) + val = frappe._dict({"sle": dependant_sle}) if key not in self.distinct_item_warehouses: self.distinct_item_warehouses[key] = val @@ -535,6 +535,8 @@ class update_entries_after(object): if getdate(dependant_sle.posting_date) < getdate(existing_sle_posting_date): val.sle_changed = True + dependent_voucher_detail_nos.append(dependant_sle.voucher_detail_no) + val.dependent_voucher_detail_nos = dependent_voucher_detail_nos self.distinct_item_warehouses[key] = val self.new_items_found = True elif dependant_sle.voucher_detail_no not in set(dependent_voucher_detail_nos): From de3b67c32749520808137aaabc609adea0dfb984 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Fri, 18 Aug 2023 15:30:59 +0000 Subject: [PATCH 05/20] chore(release): Bumped to Version 14.35.2 ## [14.35.2](https://github.com/frappe/erpnext/compare/v14.35.1...v14.35.2) (2023-08-18) ### Bug Fixes * timeout error coming during reposting (backport [#36715](https://github.com/frappe/erpnext/issues/36715)) ([#36716](https://github.com/frappe/erpnext/issues/36716)) ([d5a596d](https://github.com/frappe/erpnext/commit/d5a596dff117522b5986a0509d0f16ca279d0e9b)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 8d4340c59de..ae6060e3d62 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.35.1" +__version__ = "14.35.2" def get_default_company(user=None): From d1b2ce35b6452da2953ab99f0146a9d39f39ff5d Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 23 Aug 2023 02:59:58 +0000 Subject: [PATCH 06/20] chore(release): Bumped to Version 14.36.0 # [14.36.0](https://github.com/frappe/erpnext/compare/v14.35.2...v14.36.0) (2023-08-23) ### Bug Fixes * Accounts Payable Currency bug ([94612b9](https://github.com/frappe/erpnext/commit/94612b90ef96d20fad29af051eeed74b43971a2a)) * Add company filters for account ([e62ffa9](https://github.com/frappe/erpnext/commit/e62ffa990d2015b9df734d783fb94627bb5b78fb)) * add missing items labels back ([#36737](https://github.com/frappe/erpnext/issues/36737)) ([3634e80](https://github.com/frappe/erpnext/commit/3634e80341df075a3759b8f3b8994a02f423273d)) * broken advance field in Accounts Receivable summary rpt ([296a4d7](https://github.com/frappe/erpnext/commit/296a4d7a12714f978c2520483ed3b162ac71f843)) * broken consolidated report due to finance book filter ([5bd2a09](https://github.com/frappe/erpnext/commit/5bd2a0923f4693463ceb703cc216375325dd9c13)) * check tax and charges if it is passed ([1f76c69](https://github.com/frappe/erpnext/commit/1f76c6972b80d91fe549622556098009468ccb2c)) * clear dimension defaults after test ([2a467a9](https://github.com/frappe/erpnext/commit/2a467a9fbff26e01c77e45d7a297387ad1d83030)) * dict value for dimension for gl entries defined without the dimension ([11ba553](https://github.com/frappe/erpnext/commit/11ba553dbd72996de1118c27743dea30267a4244)) * dimension name in remark ([01ae513](https://github.com/frappe/erpnext/commit/01ae513f70308489ee814c1b361b24b2dbb34d60)) * divide offsetting amount for multiple dimensions ([1269f2d](https://github.com/frappe/erpnext/commit/1269f2d301fe03aaf36d3c2b749d6774b6e1e786)) * divide offsetting amount only when account exists ([2c8c3a0](https://github.com/frappe/erpnext/commit/2c8c3a022c28314e87eaafd3ef7c991a86e8f8af)) * Document Name link validation in Bank Reconciliation Tool ([#36495](https://github.com/frappe/erpnext/issues/36495)) ([83cbc1b](https://github.com/frappe/erpnext/commit/83cbc1bef6fb8b9302c7d6ba747d648296edd8a3)), closes [#35540](https://github.com/frappe/erpnext/issues/35540) [#35540](https://github.com/frappe/erpnext/issues/35540) * don't throw if item does not have default BOM (backport [#36709](https://github.com/frappe/erpnext/issues/36709)) ([#36734](https://github.com/frappe/erpnext/issues/36734)) ([e1bd9a7](https://github.com/frappe/erpnext/commit/e1bd9a7e8dbfe0fbbe6afddfa2370ed36bbf6767)) * duplicate acc dimension in test ([cdb66bf](https://github.com/frappe/erpnext/commit/cdb66bf19824469b55b37c5f6f93b0022fabdd0c)) * fetch acc dimensions correctly when fieldname is different from name ([7ac35b4](https://github.com/frappe/erpnext/commit/7ac35b496aabac0344175b61fbf0bbe6945539fe)) * fetch accounting dimension details specific to company ([c1f1a21](https://github.com/frappe/erpnext/commit/c1f1a21714423d44c2469a2a867ccbb996395113)) * include gain/loss journal in AR/AP reports ([4606079](https://github.com/frappe/erpnext/commit/460607956821479d13977b841669a456deb6f30e)) * incorrect gl balance on multi company setup ([cb9aad3](https://github.com/frappe/erpnext/commit/cb9aad3e873b430926f9007e6fcd2dbbf2e71111)) * incorrect schedule in asset value adjustment ([#36725](https://github.com/frappe/erpnext/issues/36725)) ([a0575ed](https://github.com/frappe/erpnext/commit/a0575ed2b0dec34ba1de14fe7b09aa8195be5e45)) * make offsetting entry for acc dimensions ([3198f26](https://github.com/frappe/erpnext/commit/3198f2669dcbb638d5bdfac3575722918dbd8046)) * make offsetting entry for all doctypes ([f578c32](https://github.com/frappe/erpnext/commit/f578c3219d517a7ba102ab4e270102b4eb6e9ded)) * mode of payment fetched from pos profile company in POS ([c74a414](https://github.com/frappe/erpnext/commit/c74a414313d721e7ee07820f3597c9ba1b7c171b)) * not able to make stock entry ([#36759](https://github.com/frappe/erpnext/issues/36759)) ([873ee38](https://github.com/frappe/erpnext/commit/873ee384a1f0832faf84015167f7bdc697f1dc46)) * Procurement Tracker report not showing material request items ([#36768](https://github.com/frappe/erpnext/issues/36768)) ([6a9935c](https://github.com/frappe/erpnext/commit/6a9935c00e502a28fa976c963a218f7e11b891ec)) * reset dimension defaults when company changedin test ([37ef6e9](https://github.com/frappe/erpnext/commit/37ef6e959b8019b953ff30175fb38b85fe16ea47)) * **RFQ:** make "update password" and "submit quotation" buttons the same size (backport [#36667](https://github.com/frappe/erpnext/issues/36667)) ([#36686](https://github.com/frappe/erpnext/issues/36686)) ([36147ec](https://github.com/frappe/erpnext/commit/36147ec02c595971dfcb73ec471bf726cad1997e)) * timeout error coming during reposting ([#36715](https://github.com/frappe/erpnext/issues/36715)) ([620b21f](https://github.com/frappe/erpnext/commit/620b21fec59e40178fde96085003d419804f21e0)) * **ux:** change batch selection message to alert (backport [#36500](https://github.com/frappe/erpnext/issues/36500)) ([#36697](https://github.com/frappe/erpnext/issues/36697)) ([0a4947a](https://github.com/frappe/erpnext/commit/0a4947a8f612244822b95fdbc94cf679a7855286)) * **UX:** Ignore prepared report ([3e23e1f](https://github.com/frappe/erpnext/commit/3e23e1fb91fdcc6e97929bb5528bb61dd15d7892)) ### Features * **RFQ:** make email message fully configurable (backport [#36353](https://github.com/frappe/erpnext/issues/36353)) ([#36531](https://github.com/frappe/erpnext/issues/36531)) ([c308bd5](https://github.com/frappe/erpnext/commit/c308bd53097679c0d5dab16af2786861b1dedf2f)) * Tick on checkbox to include draft timesheets (backport [#36577](https://github.com/frappe/erpnext/issues/36577)) ([#36640](https://github.com/frappe/erpnext/issues/36640)) ([9668615](https://github.com/frappe/erpnext/commit/9668615f7e9e602f39c00cd3bd4cbcb09039d2f2)) * utility to repost accounting ledgers without cancellation ([#36469](https://github.com/frappe/erpnext/issues/36469)) ([f8d6fe6](https://github.com/frappe/erpnext/commit/f8d6fe6be06458050105b9c57939f332e396ca80)) ### Performance Improvements * pull latest details only for referenced vouchers ([47345e8](https://github.com/frappe/erpnext/commit/47345e81a1342c3a6c904c66368460b18dd2816a)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index ae6060e3d62..22bf6f80693 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.35.2" +__version__ = "14.36.0" def get_default_company(user=None): From b95ab3425a2f61caffab3bcbbb09e0b91b8ff1ba Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 30 Aug 2023 13:56:17 +0000 Subject: [PATCH 07/20] chore(release): Bumped to Version 14.37.0 # [14.37.0](https://github.com/frappe/erpnext/compare/v14.36.0...v14.37.0) (2023-08-30) ### Bug Fixes * added valuation field type (Float/Currency) in the filter (backport [#36866](https://github.com/frappe/erpnext/issues/36866)) ([#36868](https://github.com/frappe/erpnext/issues/36868)) ([22247cf](https://github.com/frappe/erpnext/commit/22247cfa179c178ba8d6bbd76dd566f6440ee5fa)) * Allow to make return against sales invoice which has closed sales order ([0f98cc8](https://github.com/frappe/erpnext/commit/0f98cc85e9dce00fa333474cfb438f243503df81)) * Asset Category filter is not working in asset depreciation([#36806](https://github.com/frappe/erpnext/issues/36806)) ([bd41cb2](https://github.com/frappe/erpnext/commit/bd41cb221b9cfb231271f07f0977cb09771c5454)) * create entries for only PR items present in LCV ([#36852](https://github.com/frappe/erpnext/issues/36852)) ([d2091cc](https://github.com/frappe/erpnext/commit/d2091cc22c6bdc1b83b67d82c0b305f1654ae6d6)) * error in report when data is not available to load chart in report (backport [#36842](https://github.com/frappe/erpnext/issues/36842)) ([#36853](https://github.com/frappe/erpnext/issues/36853)) ([9789b7b](https://github.com/frappe/erpnext/commit/9789b7bdefd453ac647f0cb760b681c2f6d5a76e)) * error listindexoutofrange when save a production plan ([#36807](https://github.com/frappe/erpnext/issues/36807)) ([fd41594](https://github.com/frappe/erpnext/commit/fd4159423d7e127499bdde04184f9e11f5fa9e78)) * fetch JVs in tax withholding report without party values ([bc6bd81](https://github.com/frappe/erpnext/commit/bc6bd81f87921c61cc855379eb2a915dadb2ff2b)) * fetch rounded total while pulling reference details on SO ([adc87f1](https://github.com/frappe/erpnext/commit/adc87f16a31d9d35505168e97cc0967f89267d77)) * missing company flag for regional fn ([#36791](https://github.com/frappe/erpnext/issues/36791)) ([c07548a](https://github.com/frappe/erpnext/commit/c07548a61235f371b93a7afde9ab7e25c6dc03d0)) * SCR return status (backport [#36793](https://github.com/frappe/erpnext/issues/36793)) ([#36796](https://github.com/frappe/erpnext/issues/36796)) ([6edfcf4](https://github.com/frappe/erpnext/commit/6edfcf4de82156be6e2ef2204e264e59a2d3b6eb)) * Tax withholding reversal on Debit Notes ([e8dc63c](https://github.com/frappe/erpnext/commit/e8dc63c89c01f6c8617a911ac87f56fc5768da12)) ### Features * **MR:** Project and Cost Center in Connections (backport [#36794](https://github.com/frappe/erpnext/issues/36794)) ([#36795](https://github.com/frappe/erpnext/issues/36795)) ([4fa0777](https://github.com/frappe/erpnext/commit/4fa07777e98ab9a4848f235d7a5e80b88a538b80)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 22bf6f80693..6248a1b510a 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.36.0" +__version__ = "14.37.0" def get_default_company(user=None): From 46bea0e56f45d81a1f06d78fd77e648888d9a179 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 31 Aug 2023 16:55:23 +0530 Subject: [PATCH 08/20] fix: calcuate received/paid amount on rate change in PE (cherry picked from commit 64d835374b281fc7406e574b0306ed48656010ca) --- erpnext/accounts/doctype/payment_entry/payment_entry.js | 8 ++++++++ erpnext/accounts/doctype/payment_entry/payment_entry.py | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.js b/erpnext/accounts/doctype/payment_entry/payment_entry.js index cd788a896a8..4e3cf35b618 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.js +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.js @@ -526,12 +526,16 @@ frappe.ui.form.on('Payment Entry', { }, source_exchange_rate: function(frm) { + let company_currency = frappe.get_doc(":Company", frm.doc.company).default_currency; if (frm.doc.paid_amount) { frm.set_value("base_paid_amount", flt(frm.doc.paid_amount) * flt(frm.doc.source_exchange_rate)); // target exchange rate should always be same as source if both account currencies is same if(frm.doc.paid_from_account_currency == frm.doc.paid_to_account_currency) { frm.set_value("target_exchange_rate", frm.doc.source_exchange_rate); frm.set_value("base_received_amount", frm.doc.base_paid_amount); + } else if (company_currency == frm.doc.paid_to_account_currency) { + frm.set_value("received_amount", frm.doc.base_paid_amount); + frm.set_value("base_received_amount", frm.doc.base_paid_amount); } frm.events.set_unallocated_amount(frm); @@ -543,6 +547,7 @@ frappe.ui.form.on('Payment Entry', { target_exchange_rate: function(frm) { frm.set_paid_amount_based_on_received_amount = true; + let company_currency = frappe.get_doc(":Company", frm.doc.company).default_currency; if (frm.doc.received_amount) { frm.set_value("base_received_amount", @@ -552,6 +557,9 @@ frappe.ui.form.on('Payment Entry', { (frm.doc.paid_from_account_currency == frm.doc.paid_to_account_currency)) { frm.set_value("source_exchange_rate", frm.doc.target_exchange_rate); frm.set_value("base_paid_amount", frm.doc.base_received_amount); + } else if (company_currency == frm.doc.paid_from_account_currency) { + frm.set_value("paid_amount", frm.doc.base_received_amount); + frm.set_value("base_paid_amount", frm.doc.base_received_amount); } frm.events.set_unallocated_amount(frm); diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py index 765e69b75bd..1c6c99ed3e5 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -2167,7 +2167,7 @@ def set_paid_amount_and_received_amount( if bank_amount: received_amount = bank_amount else: - if company_currency != bank.account_currency: + if bank and company_currency != bank.account_currency: received_amount = paid_amount / doc.get("conversion_rate", 1) else: received_amount = paid_amount * doc.get("conversion_rate", 1) @@ -2176,7 +2176,7 @@ def set_paid_amount_and_received_amount( if bank_amount: paid_amount = bank_amount else: - if company_currency != bank.account_currency: + if bank and company_currency != bank.account_currency: paid_amount = received_amount / doc.get("conversion_rate", 1) else: # if party account currency and bank currency is different then populate paid amount as well From 09d9263082cb466d9b1a70dfb22867f2c1f222f2 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Thu, 31 Aug 2023 14:11:41 +0000 Subject: [PATCH 09/20] chore(release): Bumped to Version 14.37.1 ## [14.37.1](https://github.com/frappe/erpnext/compare/v14.37.0...v14.37.1) (2023-08-31) ### Bug Fixes * calcuate received/paid amount on rate change in PE ([46bea0e](https://github.com/frappe/erpnext/commit/46bea0e56f45d81a1f06d78fd77e648888d9a179)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 6248a1b510a..5d2189e7c11 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.37.0" +__version__ = "14.37.1" def get_default_company(user=None): From a4b80d1ec4e2a27fed4d0d9a53e61f2e65e9227b Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 6 Sep 2023 05:57:04 +0000 Subject: [PATCH 10/20] chore(release): Bumped to Version 14.38.0 # [14.38.0](https://github.com/frappe/erpnext/compare/v14.37.1...v14.38.0) (2023-09-06) ### Bug Fixes * account payable currency and value ([#36859](https://github.com/frappe/erpnext/issues/36859)) ([98c2640](https://github.com/frappe/erpnext/commit/98c26403c1daeb95feacb004d11768da9550a235)) * added ignore_user_permissions to parent field of tree doctypes ([451cc7b](https://github.com/frappe/erpnext/commit/451cc7bc12cbbd6fb17afac05bf3871116d6415b)) * added validation for unique serial numbers in pos invoice ([#36302](https://github.com/frappe/erpnext/issues/36302)) ([1192736](https://github.com/frappe/erpnext/commit/119273639c14cc89bddc45f402f6c2d8c8abc8f3)) * allow payment_account of loan repayment to be edited ([#36948](https://github.com/frappe/erpnext/issues/36948)) ([09e2f24](https://github.com/frappe/erpnext/commit/09e2f24329a9c9f7b29f6987b02fca05fc9bc4c5)) * ask for asset related accounts only when needed (backport [#36960](https://github.com/frappe/erpnext/issues/36960)) ([#36971](https://github.com/frappe/erpnext/issues/36971)) ([58163d5](https://github.com/frappe/erpnext/commit/58163d5aa8d7a24a942c78ae576f295db135364b)) * calcuate received/paid amount on rate change in PE ([0a63266](https://github.com/frappe/erpnext/commit/0a632660e065a9a5642a2e624081ba60de72f3b0)) * deduplicate gain/loss JE creation for journals as payment ([9168b3b](https://github.com/frappe/erpnext/commit/9168b3b0e8be0afeb45a6c42534675a831b6e1c4)) * difference amount in UI should not be calculated ([9bc2b41](https://github.com/frappe/erpnext/commit/9bc2b419e3ba855d7bc180b9ea6c12253e1a6ee5)) * fetch discount amount for gle in base currency ([a8b5880](https://github.com/frappe/erpnext/commit/a8b58800bb5f411ddcb9a595f42fec47ac9bcd12)) * ignore mandatory fields while saving WO (backport [#36954](https://github.com/frappe/erpnext/issues/36954)) ([#36970](https://github.com/frappe/erpnext/issues/36970)) ([c125dea](https://github.com/frappe/erpnext/commit/c125dea0f1478b25ef1234b18764597931bff7d8)) * index error on Receivable report based on payment terms ([#36963](https://github.com/frappe/erpnext/issues/36963)) ([e3d64fc](https://github.com/frappe/erpnext/commit/e3d64fc5536e05b85f0db8f53079f90fb685c554)) * invalid gain/loss JE created on base currency Expense Claim ([068f1b5](https://github.com/frappe/erpnext/commit/068f1b5a6b15fdeed79d28a2e1db1c0d057afac9)) * only show "Unreconcile" if reconciled ([61752ac](https://github.com/frappe/erpnext/commit/61752ac2b49c5e6ecaf720f87e63d53fb5c5d5e2)) * prorate factor for subscription plan ([#36953](https://github.com/frappe/erpnext/issues/36953)) ([fc79af5](https://github.com/frappe/erpnext/commit/fc79af592648912fe25a64802370eb5389de754a)) * reduce threshold for bg job fn ([5a226a8](https://github.com/frappe/erpnext/commit/5a226a8395d1d6c51917ee06584c6bfd0467cb16)) * remove withholding category from common fields ([18f8f7f](https://github.com/frappe/erpnext/commit/18f8f7f09cefa3c4b102c2a0ce6a90476d1e7d16)) * Set the default filter in All Trends Report ([132957f](https://github.com/frappe/erpnext/commit/132957f59e096f1ac049f6c448cbeb20fe33acd6)) * Set the default filter in All Trends Report ([420536c](https://github.com/frappe/erpnext/commit/420536ca522df9bfd99d7e6298a5b719cee40d09)) * when create doc from item dashboard default uom (buying or selling) is not correctly selected (backport [#36892](https://github.com/frappe/erpnext/issues/36892)) ([#36928](https://github.com/frappe/erpnext/issues/36928)) ([5c8bee0](https://github.com/frappe/erpnext/commit/5c8bee0a9592f61939aad47d601ef16eac65d63a)) ### Features * **RFQ:** optionally send document print ([#36363](https://github.com/frappe/erpnext/issues/36363)) ([345c608](https://github.com/frappe/erpnext/commit/345c6084e5461bd43ed7ef7aa7a66b50831f0fab)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 5d2189e7c11..4734e8cc0b9 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.37.1" +__version__ = "14.38.0" def get_default_company(user=None): From 7af8aec8796476385e14531b37d95c4235f1c71e Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Tue, 12 Sep 2023 12:22:33 +0000 Subject: [PATCH 11/20] chore(release): Bumped to Version 14.39.0 # [14.39.0](https://github.com/frappe/erpnext/compare/v14.38.0...v14.39.0) (2023-09-12) ### Bug Fixes * `company` is ambiguous ([fe69d53](https://github.com/frappe/erpnext/commit/fe69d5364dd03dd2e916e0c3385f3d4e6e0163b7)) * `Parent Task` link with `Project Task` (backport [#37025](https://github.com/frappe/erpnext/issues/37025)) ([#37033](https://github.com/frappe/erpnext/issues/37033)) ([6602787](https://github.com/frappe/erpnext/commit/66027877d3cdd7ac5de421d9c5b631fe07630f6a)) * correct asset daily depr schedule calculation [v14] ([#36991](https://github.com/frappe/erpnext/issues/36991)) ([2ae4463](https://github.com/frappe/erpnext/commit/2ae4463b7692704a214fceec5d67cd6c32b67af3)) * generate pdf only when result exists ([53270dd](https://github.com/frappe/erpnext/commit/53270dd933d1e1ab22787de4ecbab6894810c5e8)) * remove report field db set ([284181d](https://github.com/frappe/erpnext/commit/284181d766e4b321e0fc642b3230c1ce86338e37)) * show letterhead and terms for AR pdf ([2077b2c](https://github.com/frappe/erpnext/commit/2077b2cde413a66347b3b72e201a2702d7f6c0b6)) * Update party type for payroll payable account ([f251d6c](https://github.com/frappe/erpnext/commit/f251d6cb699cf403e559e37276ebcca01498291e)) * use primary key for link lookup (backport [#36919](https://github.com/frappe/erpnext/issues/36919)) ([#36978](https://github.com/frappe/erpnext/issues/36978)) ([4fede56](https://github.com/frappe/erpnext/commit/4fede56d98f803ee4912fa80cea386135c378d2c)) * **ux:** docstatus filter for `Reference Name` in QI (backport [#37024](https://github.com/frappe/erpnext/issues/37024)) ([#37028](https://github.com/frappe/erpnext/issues/37028)) ([21be889](https://github.com/frappe/erpnext/commit/21be889a771f815a720d44494ba2e6e8174adb83)) ### Features * add field for specifying pdf name ([657ca7f](https://github.com/frappe/erpnext/commit/657ca7ff22602ab34acc25c3c2a2d7bcd2ba25e9)) * Add half-yearly asset maintenance periodicity. (backport [#37006](https://github.com/frappe/erpnext/issues/37006)) ([#37014](https://github.com/frappe/erpnext/issues/37014)) ([acd9c69](https://github.com/frappe/erpnext/commit/acd9c692017d811f668e300fb0fedfb093df6458)) * provision to set required by from Production Plan ([#37039](https://github.com/frappe/erpnext/issues/37039)) ([d278b11](https://github.com/frappe/erpnext/commit/d278b116030df0f272c3c101b75fe3b66a344c04)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 4734e8cc0b9..12a6ba9d77a 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.38.0" +__version__ = "14.39.0" def get_default_company(user=None): From 271392562821f0aeac2e81d44e3d623500cf4133 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 20 Sep 2023 06:24:47 +0000 Subject: [PATCH 12/20] chore(release): Bumped to Version 14.40.0 # [14.40.0](https://github.com/frappe/erpnext/compare/v14.39.0...v14.40.0) (2023-09-20) ### Bug Fixes * + btn not appearing for delivery note connection (backport [#36980](https://github.com/frappe/erpnext/issues/36980)) ([#37070](https://github.com/frappe/erpnext/issues/37070)) ([c2a0c1e](https://github.com/frappe/erpnext/commit/c2a0c1e989aab8ec136a6e8c15687abcab3cb55b)) * accepted warehouse and rejected warehouse can't be same (backport [#36973](https://github.com/frappe/erpnext/issues/36973)) ([#37071](https://github.com/frappe/erpnext/issues/37071)) ([b56c9b9](https://github.com/frappe/erpnext/commit/b56c9b91f11dd9e84d02b82ea2b0b2f727c5d4e1)) * after applying coupon code, field in_words not updated ([#37133](https://github.com/frappe/erpnext/issues/37133)) ([1cb8c64](https://github.com/frappe/erpnext/commit/1cb8c64c94858134c4765f2c21ebbce7394ec795)) * Apply dimension filter, irrespective of dimesion columns ([9bc44a3](https://github.com/frappe/erpnext/commit/9bc44a3b40c661ceb4821d90f70fc160d406bf8e)) * asset validation misfire on debit notes ([b33db6c](https://github.com/frappe/erpnext/commit/b33db6c79a6b7f37c93f7e49d6721ee8d7593527)) * company wise deferred accounting fields in item ([#37023](https://github.com/frappe/erpnext/issues/37023)) ([13aaff3](https://github.com/frappe/erpnext/commit/13aaff30a5d6ae27d131eecee6f9f54575f2688c)) * Don't allow merging accounts with different currency ([#37074](https://github.com/frappe/erpnext/issues/37074)) ([c41cb39](https://github.com/frappe/erpnext/commit/c41cb3930c76efb620cf8bc27672dab8c5302e6c)) * don't set from warehouse for purchase material request ([#37132](https://github.com/frappe/erpnext/issues/37132)) ([e62b783](https://github.com/frappe/erpnext/commit/e62b783f340844783352030de422c6be14b3ddfc)) * Duplicate Serial Nos validation in POS ([#36927](https://github.com/frappe/erpnext/issues/36927)) ([366325c](https://github.com/frappe/erpnext/commit/366325ca3ca0a99bb2384755c6f1cc7021649380)) * fetch logic for repay_from_salary in loan_repayment [v14] ([#37135](https://github.com/frappe/erpnext/issues/37135)) ([480a0ca](https://github.com/frappe/erpnext/commit/480a0ca7a8d97bbaa4de103a722e823ff5aed47f)) * ignore user permissions for `Source Warehouse` in MR (backport [#37102](https://github.com/frappe/erpnext/issues/37102)) ([#37110](https://github.com/frappe/erpnext/issues/37110)) ([727dcc5](https://github.com/frappe/erpnext/commit/727dcc5034749f2505052aa05c9ad8d8b94fa324)) * incorrect stock ledger entries in DN (backport [#36944](https://github.com/frappe/erpnext/issues/36944)) ([#37066](https://github.com/frappe/erpnext/issues/37066)) ([699ad80](https://github.com/frappe/erpnext/commit/699ad8080236e9b54c93e71587a027080ce422eb)) * packed item using expired price ([413b40f](https://github.com/frappe/erpnext/commit/413b40f5a770e062732f850714d3ea75de2b4337)) * POS opening Issue if Product Bundle is available ([#37138](https://github.com/frappe/erpnext/issues/37138)) ([af05864](https://github.com/frappe/erpnext/commit/af05864e6db336b2897b1138ec25e59caba0a568)) * precision issue and column name ([#37073](https://github.com/frappe/erpnext/issues/37073)) ([f2395a9](https://github.com/frappe/erpnext/commit/f2395a92971f48904e88afb929285def7ba221e4)) * Purchase Receipt Provisional Accounting GL Entries (backport [#37046](https://github.com/frappe/erpnext/issues/37046)) ([#37068](https://github.com/frappe/erpnext/issues/37068)) ([8772e40](https://github.com/frappe/erpnext/commit/8772e40bae96db49b1d8653a5e8e5cb975f492ad)) * Remove redundant code ([#37001](https://github.com/frappe/erpnext/issues/37001)) ([3ecdf02](https://github.com/frappe/erpnext/commit/3ecdf028f28229d230faef07babd126ef13ac4fc)) * **ux:** move `get_route_options_for_new_doc` to `refresh` ([#37092](https://github.com/frappe/erpnext/issues/37092)) ([a563fed](https://github.com/frappe/erpnext/commit/a563fed6dcaf99fa799cbf034dc6d38473e0fd57)) * validate duplicate serial no in DN ([fffa13f](https://github.com/frappe/erpnext/commit/fffa13f22b39cd768b081a52d454a03b386596ba)) ### Features * provision to create RIV from `Stock Ledger Invariant Check` report (backport [#37115](https://github.com/frappe/erpnext/issues/37115)) ([#37147](https://github.com/frappe/erpnext/issues/37147)) ([29ff0ce](https://github.com/frappe/erpnext/commit/29ff0ce286255307ac78652776a8e158b89222ae)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 12a6ba9d77a..529c9ca9d80 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.39.0" +__version__ = "14.40.0" def get_default_company(user=None): From abb60442918c5e86e00bbf8e5f0d07e5f1f5f2ab Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 27 Sep 2023 05:40:33 +0000 Subject: [PATCH 13/20] chore(release): Bumped to Version 14.41.0 # [14.41.0](https://github.com/frappe/erpnext/compare/v14.40.0...v14.41.0) (2023-09-27) ### Bug Fixes * allow to select parent warehouse in the website item (backport [#37047](https://github.com/frappe/erpnext/issues/37047)) ([#37173](https://github.com/frappe/erpnext/issues/37173)) ([56657b6](https://github.com/frappe/erpnext/commit/56657b6122c056a8ba091b41fd1b6e94447f34da)) * AP & AR summary filters to match AR (backport [#37248](https://github.com/frappe/erpnext/issues/37248)) ([#37261](https://github.com/frappe/erpnext/issues/37261)) ([1dc58b3](https://github.com/frappe/erpnext/commit/1dc58b36603ffbd11a5467f62b36d9148a831534)) * apply gl report filters ([b4bc44d](https://github.com/frappe/erpnext/commit/b4bc44db4a8d459de02ee80b0516f20913897b95)) * german translation of Sales and Purchase Invoice ([#37122](https://github.com/frappe/erpnext/issues/37122)) ([8236814](https://github.com/frappe/erpnext/commit/8236814270f2a74bb5ae46ea7d3818c2ddc7619b)) * incorrect `Parent Task` getting set for 2nd to nth child Task (backport [#37230](https://github.com/frappe/erpnext/issues/37230)) ([#37240](https://github.com/frappe/erpnext/issues/37240)) ([279f21d](https://github.com/frappe/erpnext/commit/279f21d1e54208790a6fdcf4c828fdef3a74468d)) * labels for `Stock Ledger Invariant Check` report (backport [#37150](https://github.com/frappe/erpnext/issues/37150)) ([#37176](https://github.com/frappe/erpnext/issues/37176)) ([f2bcfb5](https://github.com/frappe/erpnext/commit/f2bcfb5f977927cad9f4288b667bbce4d231c6c8)) * **Material Request:** consider project for item details (backport [#37215](https://github.com/frappe/erpnext/issues/37215)) ([#37221](https://github.com/frappe/erpnext/issues/37221)) ([25f800d](https://github.com/frappe/erpnext/commit/25f800d3f5cfd4a3c4d58b455b54d47a782d0d76)) * reserved qty for production plan ([#37251](https://github.com/frappe/erpnext/issues/37251)) ([0a0d5b3](https://github.com/frappe/erpnext/commit/0a0d5b3e6612be1b6e1c9febd4a86a772a02511d)) * serial number decimal issue ([#37242](https://github.com/frappe/erpnext/issues/37242)) ([78ab201](https://github.com/frappe/erpnext/commit/78ab2013e59bb6a95d10164328ad3f7c815497b5)) * set customer currency in pos_invoice if exists ([e0da8d2](https://github.com/frappe/erpnext/commit/e0da8d261f7b0f73f898bc80f51788843cae6051)) * Update `advance_paid` in SO/PO after unlinking from advance entry ([1181dcf](https://github.com/frappe/erpnext/commit/1181dcf521b6d5bc6f96a217f6991e0d5cb138d3)) * validate duplicate serial no on submit in DN ([#37243](https://github.com/frappe/erpnext/issues/37243)) ([70e2093](https://github.com/frappe/erpnext/commit/70e2093941dba32ae06d4af123e9daa2441c8e71)) ### Features * `Stock Ledger Variance` report (backport [#37165](https://github.com/frappe/erpnext/issues/37165)) ([#37183](https://github.com/frappe/erpnext/issues/37183)) ([02fc67c](https://github.com/frappe/erpnext/commit/02fc67c83c94b6277e4e6dafd22381ed04da0ad6)) * Toggle net values in Trial Balance report ([57c82c1](https://github.com/frappe/erpnext/commit/57c82c18008ace3b95ccf984be06bb60ec51fe66)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 529c9ca9d80..22fe46b476b 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.40.0" +__version__ = "14.41.0" def get_default_company(user=None): From 53817e463fa8f69c5138a38556826d3ee914b811 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 27 Sep 2023 12:37:05 +0530 Subject: [PATCH 14/20] fix: trial balance report freezes when adding filters (backport #37264) (#37266) fix: trial balance report freezes when adding filters (#37264) fix: Only add onclick if correct data is returned workaround for https://github.com/frappe/datatable/issues/177 (cherry picked from commit 2dc95e5d59526a531b064815d195df8413d1b837) Co-authored-by: Ankush Menat --- erpnext/public/js/financial_statements.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/erpnext/public/js/financial_statements.js b/erpnext/public/js/financial_statements.js index 959cf507d53..907a775bfa5 100644 --- a/erpnext/public/js/financial_statements.js +++ b/erpnext/public/js/financial_statements.js @@ -6,8 +6,10 @@ erpnext.financial_statements = { if (data && column.fieldname=="account") { value = data.account_name || value; - column.link_onclick = - "erpnext.financial_statements.open_general_ledger(" + JSON.stringify(data) + ")"; + if (data.account) { + column.link_onclick = + "erpnext.financial_statements.open_general_ledger(" + JSON.stringify(data) + ")"; + } column.is_tree = true; } From 1b86e7e2f5f121e2b1885a914a2cdbe221c0f0da Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 27 Sep 2023 07:08:57 +0000 Subject: [PATCH 15/20] chore(release): Bumped to Version 14.41.1 ## [14.41.1](https://github.com/frappe/erpnext/compare/v14.41.0...v14.41.1) (2023-09-27) ### Bug Fixes * trial balance report freezes when adding filters (backport [#37264](https://github.com/frappe/erpnext/issues/37264)) ([#37266](https://github.com/frappe/erpnext/issues/37266)) ([53817e4](https://github.com/frappe/erpnext/commit/53817e463fa8f69c5138a38556826d3ee914b811)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 22fe46b476b..f25a601a2ec 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.41.0" +__version__ = "14.41.1" def get_default_company(user=None): From cfb3a9eabf2f77bd7bd96121c281f55fd644c535 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 29 Sep 2023 12:18:35 +0530 Subject: [PATCH 16/20] fix: incorrect qty for material request in Production Plan (backport #37270) (#37290) fix: incorrect qty for material request in Production Plan (#37270) (cherry picked from commit 8fe4a4d3aa7857e5e241bcb7145065753ab8b4cb) Co-authored-by: rohitwaghchaure --- .../production_plan/production_plan.py | 27 ++++----- .../production_plan/test_production_plan.py | 58 +++++++++++++++++++ 2 files changed, 70 insertions(+), 15 deletions(-) diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.py b/erpnext/manufacturing/doctype/production_plan/production_plan.py index fcaae79d6c5..52bfeafea51 100644 --- a/erpnext/manufacturing/doctype/production_plan/production_plan.py +++ b/erpnext/manufacturing/doctype/production_plan/production_plan.py @@ -1508,6 +1508,10 @@ def get_items_for_material_requests(doc, warehouses=None, get_parent_warehouse_d def get_materials_from_other_locations(item, warehouses, new_mr_items, company): from erpnext.stock.doctype.pick_list.pick_list import get_available_item_locations + stock_uom, purchase_uom = frappe.db.get_value( + "Item", item.get("item_code"), ["stock_uom", "purchase_uom"] + ) + locations = get_available_item_locations( item.get("item_code"), warehouses, item.get("quantity"), company, ignore_validation=True ) @@ -1518,6 +1522,10 @@ def get_materials_from_other_locations(item, warehouses, new_mr_items, company): if required_qty <= 0: return + conversion_factor = 1.0 + if purchase_uom != stock_uom and purchase_uom == item["uom"]: + conversion_factor = get_uom_conversion_factor(item["item_code"], item["uom"]) + new_dict = copy.deepcopy(item) quantity = required_qty if d.get("qty") > required_qty else d.get("qty") @@ -1530,25 +1538,14 @@ def get_materials_from_other_locations(item, warehouses, new_mr_items, company): } ) - required_qty -= quantity + required_qty -= quantity / conversion_factor new_mr_items.append(new_dict) # raise purchase request for remaining qty - if required_qty: - stock_uom, purchase_uom = frappe.db.get_value( - "Item", item["item_code"], ["stock_uom", "purchase_uom"] - ) - if purchase_uom != stock_uom and purchase_uom == item["uom"]: - conversion_factor = get_uom_conversion_factor(item["item_code"], item["uom"]) - if not (conversion_factor or frappe.flags.show_qty_in_stock_uom): - frappe.throw( - _("UOM Conversion factor ({0} -> {1}) not found for item: {2}").format( - purchase_uom, stock_uom, item["item_code"] - ) - ) - - required_qty = required_qty / conversion_factor + precision = frappe.get_precision("Material Request Plan Item", "quantity") + if flt(required_qty, precision) > 0: + required_qty = required_qty if frappe.db.get_value("UOM", purchase_uom, "must_be_whole_number"): required_qty = ceil(required_qty) diff --git a/erpnext/manufacturing/doctype/production_plan/test_production_plan.py b/erpnext/manufacturing/doctype/production_plan/test_production_plan.py index 9ea746cbd8b..c276f6a91b9 100644 --- a/erpnext/manufacturing/doctype/production_plan/test_production_plan.py +++ b/erpnext/manufacturing/doctype/production_plan/test_production_plan.py @@ -1219,6 +1219,64 @@ class TestProductionPlan(FrappeTestCase): if row.item_code == "SubAssembly2 For SUB Test": self.assertEqual(row.quantity, 10) + def test_transfer_and_purchase_mrp_for_purchase_uom(self): + from erpnext.manufacturing.doctype.bom.test_bom import create_nested_bom + from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse + + bom_tree = { + "Test FG Item INK PEN": { + "Test RM Item INK": {}, + } + } + + parent_bom = create_nested_bom(bom_tree, prefix="") + if not frappe.db.exists("UOM Conversion Detail", {"parent": "Test RM Item INK", "uom": "Kg"}): + doc = frappe.get_doc("Item", "Test RM Item INK") + doc.purchase_uom = "Kg" + doc.append("uoms", {"uom": "Kg", "conversion_factor": 0.5}) + doc.save() + + wh1 = create_warehouse("PNE Warehouse", company="_Test Company") + wh2 = create_warehouse("MBE Warehouse", company="_Test Company") + mrp_warhouse = create_warehouse("MRPBE Warehouse", company="_Test Company") + + make_stock_entry( + item_code="Test RM Item INK", + qty=2, + rate=100, + target=wh1, + ) + + make_stock_entry( + item_code="Test RM Item INK", + qty=2, + rate=100, + target=wh2, + ) + + plan = create_production_plan( + item_code=parent_bom.item, + planned_qty=10, + do_not_submit=1, + warehouse="_Test Warehouse - _TC", + ) + + plan.for_warehouse = mrp_warhouse + + items = get_items_for_material_requests( + plan.as_dict(), warehouses=[{"warehouse": wh1}, {"warehouse": wh2}] + ) + + for row in items: + row = frappe._dict(row) + if row.material_request_type == "Material Transfer": + self.assertTrue(row.from_warehouse in [wh1, wh2]) + self.assertEqual(row.quantity, 2) + + if row.material_request_type == "Purchase": + self.assertTrue(row.warehouse == mrp_warhouse) + self.assertEqual(row.quantity, 12) + def create_production_plan(**args): """ From 7fd4d3c8822a3fbc724f1ac4f093124a03b0abfe Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Fri, 29 Sep 2023 06:50:09 +0000 Subject: [PATCH 17/20] chore(release): Bumped to Version 14.41.2 ## [14.41.2](https://github.com/frappe/erpnext/compare/v14.41.1...v14.41.2) (2023-09-29) ### Bug Fixes * incorrect qty for material request in Production Plan (backport [#37270](https://github.com/frappe/erpnext/issues/37270)) ([#37290](https://github.com/frappe/erpnext/issues/37290)) ([cfb3a9e](https://github.com/frappe/erpnext/commit/cfb3a9eabf2f77bd7bd96121c281f55fd644c535)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index f25a601a2ec..7ef8bf3f03f 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.41.1" +__version__ = "14.41.2" def get_default_company(user=None): From 9f1b9320e9b56eb15509917f3f49da4d1274b285 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 4 Oct 2023 02:15:16 +0000 Subject: [PATCH 18/20] chore(release): Bumped to Version 14.42.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # [14.42.0](https://github.com/frappe/erpnext/compare/v14.41.2...v14.42.0) (2023-10-04) ### Bug Fixes * add only float row values for total ([020aedb](https://github.com/frappe/erpnext/commit/020aedb8b010a5503e8f57f7e690aaf0b3f07266)) * currency symbol in the Supplier Quotation Comparison report ([#37337](https://github.com/frappe/erpnext/issues/37337)) ([82e8606](https://github.com/frappe/erpnext/commit/82e8606b3c4403d79556c896a98f942762cd8fa7)) * Description field for the 'Ignore Available Stock' ([#37293](https://github.com/frappe/erpnext/issues/37293)) ([7f1483a](https://github.com/frappe/erpnext/commit/7f1483ad707feac6413994400217413e5c167c7b)) * do not consider submitted Work Orders in the Production Plan Res… ([#37343](https://github.com/frappe/erpnext/issues/37343)) ([c3aeb2d](https://github.com/frappe/erpnext/commit/c3aeb2dec58190d16a18e2609fd57054bda54e43)) * ignore user permissions for `Source Warehouse` (backport [#37313](https://github.com/frappe/erpnext/issues/37313)) ([#37314](https://github.com/frappe/erpnext/issues/37314)) ([04f0dfb](https://github.com/frappe/erpnext/commit/04f0dfb691fa0f9ea03518b28a7053454610f7c7)) * incorrect qty for material request in Production Plan ([#37270](https://github.com/frappe/erpnext/issues/37270)) ([8fe4a4d](https://github.com/frappe/erpnext/commit/8fe4a4d3aa7857e5e241bcb7145065753ab8b4cb)) * Not unique table/alias: 'tabTask' (backport [#37285](https://github.com/frappe/erpnext/issues/37285)) ([#37298](https://github.com/frappe/erpnext/issues/37298)) ([95e0bf5](https://github.com/frappe/erpnext/commit/95e0bf5e0edc7886bcb56c781ec56e0b72577b8e)) * party format in test ([28756bf](https://github.com/frappe/erpnext/commit/28756bf7b6ddd0b012235e4c0c44d583586c08a5)) * PCV posting issues ([#37029](https://github.com/frappe/erpnext/issues/37029)) ([92eabe3](https://github.com/frappe/erpnext/commit/92eabe3cf50799c6709c44197e138738560aac14)) * process soa filter for multiselect ([4962b67](https://github.com/frappe/erpnext/commit/4962b67358a7b31cbe0c93f186dc7fe030271cc7)) * query for multiselect filter ([6d7aa2a](https://github.com/frappe/erpnext/commit/6d7aa2ae942c34daf35ed617f52d58f94d9c43e5)) * set route filter values for AP ([49f0f1c](https://github.com/frappe/erpnext/commit/49f0f1ca09c6182d3e55a94733f1acc4ad5a1342)) * set route filter values for AR ([2b30727](https://github.com/frappe/erpnext/commit/2b30727fdcc447d8e96b4d735feb230f2956d04c)) * summary report filters ([403ff69](https://github.com/frappe/erpnext/commit/403ff697e94d79a31dd61d6ea9f5770106a07cf2)) * trial balance report freezes when adding filters (backport [#37264](https://github.com/frappe/erpnext/issues/37264)) ([#37265](https://github.com/frappe/erpnext/issues/37265)) ([6a8146b](https://github.com/frappe/erpnext/commit/6a8146ba8a2ef34da586adca3a3c27b12821deec)) * Use default Cost Center of the Company for additional discount ([#37234](https://github.com/frappe/erpnext/issues/37234)) ([e483b4a](https://github.com/frappe/erpnext/commit/e483b4a78a260629e994eb2e0a36a59b96919288)) * validation message for valuation rate ([#37301](https://github.com/frappe/erpnext/issues/37301)) ([643bb05](https://github.com/frappe/erpnext/commit/643bb0511ce6b858d84613d08b551b7f15c6364a)) ### Features * asset salvage_value_percentage (backport [#37302](https://github.com/frappe/erpnext/issues/37302)) ([#37334](https://github.com/frappe/erpnext/issues/37334)) ([6daea6c](https://github.com/frappe/erpnext/commit/6daea6ccb2355df957ba73cff917f15d6db4eba7)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 7ef8bf3f03f..eb7d50ff198 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.41.2" +__version__ = "14.42.0" def get_default_company(user=None): From 69476861419f067ce6638063b3c2ca14ced04e7b Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 4 Oct 2023 19:46:30 +0530 Subject: [PATCH 19/20] feat: composite WIP asset (backport #37352) (#37360) feat: composite WIP asset (#37352) feat: wip composite asset (cherry picked from commit 0ecd7d2bf5eb522315776bae5633486d89791e00) Co-authored-by: Anand Baburajan --- .../purchase_invoice/purchase_invoice.js | 6 + .../purchase_invoice_item.json | 11 +- erpnext/assets/doctype/asset/asset.js | 44 ++++- erpnext/assets/doctype/asset/asset.json | 29 +++- erpnext/assets/doctype/asset/asset.py | 11 +- erpnext/assets/doctype/asset/test_asset.py | 1 + .../asset_capitalization.js | 72 ++++++-- .../asset_capitalization.json | 36 ++-- .../asset_capitalization.py | 159 ++++++++++++++++-- .../test_asset_capitalization.py | 74 ++++++++ .../purchase_receipt/purchase_receipt.js | 6 + .../purchase_receipt_item.json | 11 +- 12 files changed, 406 insertions(+), 54 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js index 5c82cf99438..ceb8204bd5d 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -460,6 +460,12 @@ cur_frm.set_query("expense_account", "items", function(doc) { } }); +cur_frm.set_query("wip_composite_asset", "items", function() { + return { + filters: {'is_composite_asset': 1, 'docstatus': 0 } + } +}); + cur_frm.cscript.expense_account = function(doc, cdt, cdn){ var d = locals[cdt][cdn]; if(d.idx == 1 && d.expense_account){ diff --git a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json index 92db6b61bb9..04f28beda9e 100644 --- a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json +++ b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json @@ -75,6 +75,7 @@ "manufacturer_part_no", "accounting", "expense_account", + "wip_composite_asset", "col_break5", "is_fixed_asset", "asset_location", @@ -877,12 +878,18 @@ "fieldname": "apply_tds", "fieldtype": "Check", "label": "Apply TDS" + }, + { + "fieldname": "wip_composite_asset", + "fieldtype": "Link", + "label": "WIP Composite Asset", + "options": "Asset" } ], "idx": 1, "istable": 1, "links": [], - "modified": "2023-07-04 17:22:21.501152", + "modified": "2023-10-03 21:01:01.824892", "modified_by": "Administrator", "module": "Accounts", "name": "Purchase Invoice Item", @@ -892,4 +899,4 @@ "sort_field": "modified", "sort_order": "DESC", "states": [] -} +} \ No newline at end of file diff --git a/erpnext/assets/doctype/asset/asset.js b/erpnext/assets/doctype/asset/asset.js index 5c1da91fdf9..0605189fec0 100644 --- a/erpnext/assets/doctype/asset/asset.js +++ b/erpnext/assets/doctype/asset/asset.js @@ -147,6 +147,15 @@ frappe.ui.form.on('Asset', { if (frm.doc.docstatus == 0) { frm.toggle_reqd("finance_books", frm.doc.calculate_depreciation); + + if (frm.doc.is_composite_asset && !frm.doc.capitalized_in) { + $('.primary-action').prop('hidden', true); + $('.form-message').text('Capitalize this asset to confirm'); + + frm.add_custom_button(__("Capitalize Asset"), function() { + frm.trigger("create_asset_capitalization"); + }); + } } }, @@ -168,7 +177,7 @@ frappe.ui.form.on('Asset', { frm.set_df_property('purchase_invoice', 'read_only', 1); frm.set_df_property('purchase_receipt', 'read_only', 1); } - else if (frm.doc.is_existing_asset) { + else if (frm.doc.is_existing_asset || frm.doc.is_composite_asset) { frm.toggle_reqd('purchase_receipt', 0); frm.toggle_reqd('purchase_invoice', 0); } @@ -300,7 +309,17 @@ frappe.ui.form.on('Asset', { is_existing_asset: function(frm) { frm.trigger("toggle_reference_doc"); - // frm.toggle_reqd("next_depreciation_date", (!frm.doc.is_existing_asset && frm.doc.calculate_depreciation)); + }, + + is_composite_asset: function(frm) { + if(frm.doc.is_composite_asset) { + frm.set_value('gross_purchase_amount', 0); + frm.set_df_property('gross_purchase_amount', 'read_only', 1); + } else { + frm.set_df_property('gross_purchase_amount', 'read_only', 0); + } + + frm.trigger("toggle_reference_doc"); }, make_schedules_editable: function(frm) { @@ -361,6 +380,19 @@ frappe.ui.form.on('Asset', { }); }, + create_asset_capitalization: function(frm) { + frappe.call({ + args: { + "asset": frm.doc.name, + }, + method: "erpnext.assets.doctype.asset.asset.create_asset_capitalization", + callback: function(r) { + var doclist = frappe.model.sync(r.message); + frappe.set_route("Form", doclist[0].doctype, doclist[0].name); + } + }); + }, + split_asset: function(frm) { const title = __('Split Asset'); @@ -424,9 +456,11 @@ frappe.ui.form.on('Asset', { }, gross_purchase_amount: function(frm) { - frm.doc.finance_books.forEach(d => { - frm.events.set_depreciation_rate(frm, d); - }) + if (frm.doc.finance_books) { + frm.doc.finance_books.forEach(d => { + frm.events.set_depreciation_rate(frm, d); + }) + } }, purchase_receipt: (frm) => { diff --git a/erpnext/assets/doctype/asset/asset.json b/erpnext/assets/doctype/asset/asset.json index 060d991945b..1da3edcc60e 100644 --- a/erpnext/assets/doctype/asset/asset.json +++ b/erpnext/assets/doctype/asset/asset.json @@ -14,6 +14,7 @@ "asset_owner", "asset_owner_company", "is_existing_asset", + "is_composite_asset", "supplier", "customer", "image", @@ -72,7 +73,8 @@ "purchase_receipt_amount", "default_finance_book", "depr_entry_posting_status", - "amended_from" + "amended_from", + "capitalized_in" ], "fields": [ { @@ -199,7 +201,7 @@ "fieldtype": "Date", "label": "Purchase Date", "read_only": 1, - "read_only_depends_on": "eval:!doc.is_existing_asset", + "read_only_depends_on": "eval:!doc.is_existing_asset && !doc.is_composite_asset", "reqd": 1 }, { @@ -237,10 +239,12 @@ "default": "0", "fieldname": "calculate_depreciation", "fieldtype": "Check", - "label": "Calculate Depreciation" + "label": "Calculate Depreciation", + "read_only_depends_on": "eval:doc.is_composite_asset && !doc.gross_purchase_amount" }, { "default": "0", + "depends_on": "eval:!doc.is_composite_asset", "fieldname": "is_existing_asset", "fieldtype": "Check", "label": "Is Existing Asset" @@ -492,7 +496,7 @@ "fieldname": "asset_quantity", "fieldtype": "Int", "label": "Asset Quantity", - "read_only_depends_on": "eval:!doc.is_existing_asset" + "read_only_depends_on": "eval:!doc.is_existing_asset && !doc.is_composite_asset" }, { "fieldname": "depr_entry_posting_status", @@ -510,6 +514,21 @@ "fieldname": "is_fully_depreciated", "fieldtype": "Check", "label": "Is Fully Depreciated" + }, + { + "default": "0", + "depends_on": "eval:!doc.is_existing_asset", + "fieldname": "is_composite_asset", + "fieldtype": "Check", + "label": "Is Composite Asset" + }, + { + "fieldname": "capitalized_in", + "fieldtype": "Link", + "hidden": 1, + "label": "Capitalized In", + "options": "Asset Capitalization", + "read_only": 1 } ], "idx": 72, @@ -538,7 +557,7 @@ "table_fieldname": "accounts" } ], - "modified": "2023-08-10 20:25:09.913073", + "modified": "2023-10-03 23:28:26.732269", "modified_by": "Administrator", "module": "Assets", "name": "Asset", diff --git a/erpnext/assets/doctype/asset/asset.py b/erpnext/assets/doctype/asset/asset.py index 81a35ad8f93..d54d15afaf6 100644 --- a/erpnext/assets/doctype/asset/asset.py +++ b/erpnext/assets/doctype/asset/asset.py @@ -234,7 +234,7 @@ class Asset(AccountsController): if not self.asset_category: self.asset_category = frappe.get_cached_value("Item", self.item_code, "asset_category") - if not flt(self.gross_purchase_amount): + if not flt(self.gross_purchase_amount) and not self.is_composite_asset: frappe.throw(_("Gross Purchase Amount is mandatory"), frappe.MandatoryError) if is_cwip_accounting_enabled(self.asset_category): @@ -1166,6 +1166,15 @@ def create_asset_repair(asset, asset_name): return asset_repair +@frappe.whitelist() +def create_asset_capitalization(asset): + asset_capitalization = frappe.new_doc("Asset Capitalization") + asset_capitalization.update( + {"target_asset": asset, "capitalization_method": "Choose a WIP composite asset"} + ) + return asset_capitalization + + @frappe.whitelist() def create_asset_value_adjustment(asset, asset_category, company): asset_value_adjustment = frappe.new_doc("Asset Value Adjustment") diff --git a/erpnext/assets/doctype/asset/test_asset.py b/erpnext/assets/doctype/asset/test_asset.py index 1adbeed65a5..fc36df8aec5 100644 --- a/erpnext/assets/doctype/asset/test_asset.py +++ b/erpnext/assets/doctype/asset/test_asset.py @@ -1686,6 +1686,7 @@ def create_asset(**args): "location": args.location or "Test Location", "asset_owner": args.asset_owner or "Company", "is_existing_asset": args.is_existing_asset or 1, + "is_composite_asset": args.is_composite_asset or 0, "asset_quantity": args.get("asset_quantity") or 1, "depr_entry_posting_status": args.depr_entry_posting_status or "", } diff --git a/erpnext/assets/doctype/asset_capitalization/asset_capitalization.js b/erpnext/assets/doctype/asset_capitalization/asset_capitalization.js index b312f93d319..304bdf26dee 100644 --- a/erpnext/assets/doctype/asset_capitalization/asset_capitalization.js +++ b/erpnext/assets/doctype/asset_capitalization/asset_capitalization.js @@ -15,9 +15,15 @@ erpnext.assets.AssetCapitalization = class AssetCapitalization extends erpnext.s refresh() { this.show_general_ledger(); + if ((this.frm.doc.stock_items && this.frm.doc.stock_items.length) || !this.frm.doc.target_is_fixed_asset) { this.show_stock_ledger(); } + + if (this.frm.doc.stock_items && !this.frm.doc.stock_items.length && this.frm.doc.target_asset && this.frm.doc.capitalization_method === "Choose a WIP composite asset") { + this.set_consumed_stock_items_tagged_to_wip_composite_asset(this.frm.doc.target_asset); + this.get_target_asset_details(); + } } setup_queries() { @@ -34,18 +40,9 @@ erpnext.assets.AssetCapitalization = class AssetCapitalization extends erpnext.s }); me.frm.set_query("target_asset", function() { - var filters = {}; - - if (me.frm.doc.target_item_code) { - filters['item_code'] = me.frm.doc.target_item_code; - } - - filters['status'] = ["not in", ["Draft", "Scrapped", "Sold", "Capitalized", "Decapitalized"]]; - filters['docstatus'] = 1; - return { - filters: filters - }; + filters: {'is_composite_asset': 1, 'docstatus': 0 } + } }); me.frm.set_query("asset", "asset_items", function() { @@ -104,6 +101,39 @@ erpnext.assets.AssetCapitalization = class AssetCapitalization extends erpnext.s return this.get_target_item_details(); } + target_asset() { + if (this.frm.doc.target_asset && this.frm.doc.capitalization_method === "Choose a WIP composite asset") { + this.set_consumed_stock_items_tagged_to_wip_composite_asset(this.frm.doc.target_asset); + this.get_target_asset_details(); + } + } + + set_consumed_stock_items_tagged_to_wip_composite_asset(asset) { + var me = this; + + if (asset) { + return me.frm.call({ + method: "erpnext.assets.doctype.asset_capitalization.asset_capitalization.get_items_tagged_to_wip_composite_asset", + args: { + asset: asset, + }, + callback: function (r) { + if (!r.exc && r.message) { + me.frm.clear_table("stock_items"); + + for (let item of r.message) { + me.frm.add_child("stock_items", item); + } + + refresh_field("stock_items"); + + me.calculate_totals(); + } + } + }); + } + } + item_code(doc, cdt, cdn) { var row = frappe.get_doc(cdt, cdn); if (cdt === "Asset Capitalization Stock Item") { @@ -218,6 +248,26 @@ erpnext.assets.AssetCapitalization = class AssetCapitalization extends erpnext.s } } + get_target_asset_details() { + var me = this; + + if (me.frm.doc.target_asset) { + return me.frm.call({ + method: "erpnext.assets.doctype.asset_capitalization.asset_capitalization.get_target_asset_details", + child: me.frm.doc, + args: { + asset: me.frm.doc.target_asset, + company: me.frm.doc.company, + }, + callback: function (r) { + if (!r.exc) { + me.frm.refresh_fields(); + } + } + }); + } + } + get_consumed_stock_item_details(row) { var me = this; diff --git a/erpnext/assets/doctype/asset_capitalization/asset_capitalization.json b/erpnext/assets/doctype/asset_capitalization/asset_capitalization.json index 04b0c4e5132..9ddc44212f6 100644 --- a/erpnext/assets/doctype/asset_capitalization/asset_capitalization.json +++ b/erpnext/assets/doctype/asset_capitalization/asset_capitalization.json @@ -8,24 +8,25 @@ "engine": "InnoDB", "field_order": [ "title", + "company", "naming_series", "entry_type", - "target_item_code", - "target_asset", "target_item_name", "target_is_fixed_asset", "target_has_batch_no", "target_has_serial_no", "column_break_9", - "target_asset_name", + "capitalization_method", + "target_item_code", "target_asset_location", + "target_asset", + "target_asset_name", "target_warehouse", "target_qty", "target_stock_uom", "target_batch_no", "target_serial_no", "column_break_5", - "company", "finance_book", "posting_date", "posting_time", @@ -57,12 +58,13 @@ "label": "Title" }, { + "depends_on": "eval:(doc.target_item_code && !doc.__islocal && doc.capitalization_method !== 'Choose a WIP composite asset') || ((doc.entry_type=='Capitalization' && doc.capitalization_method=='Create a new composite asset') || doc.entry_type=='Decapitalization')", "fieldname": "target_item_code", "fieldtype": "Link", "in_standard_filter": 1, "label": "Target Item Code", - "options": "Item", - "reqd": 1 + "mandatory_depends_on": "eval:(doc.entry_type=='Capitalization' && doc.capitalization_method=='Create a new composite asset') || doc.entry_type=='Decapitalization'", + "options": "Item" }, { "depends_on": "eval:doc.target_item_code && doc.target_item_name != doc.target_item_code", @@ -86,16 +88,18 @@ "fieldtype": "Column Break" }, { + "depends_on": "eval:(doc.target_asset && !doc.__islocal) || (doc.entry_type=='Capitalization' && doc.capitalization_method=='Choose a WIP composite asset')", "fieldname": "target_asset", "fieldtype": "Link", "in_standard_filter": 1, "label": "Target Asset", + "mandatory_depends_on": "eval:doc.entry_type=='Capitalization' && doc.capitalization_method=='Choose a WIP composite asset'", "no_copy": 1, "options": "Asset", - "read_only": 1 + "read_only_depends_on": "eval:(doc.entry_type=='Decapitalization') || (doc.entry_type=='Capitalization' && doc.capitalization_method=='Create a new composite asset')" }, { - "depends_on": "eval:doc.entry_type=='Capitalization'", + "depends_on": "eval:(doc.target_asset_name && !doc.__islocal) || (doc.target_asset && doc.entry_type=='Capitalization' && doc.capitalization_method=='Choose a WIP composite asset')", "fetch_from": "target_asset.asset_name", "fieldname": "target_asset_name", "fieldtype": "Data", @@ -186,12 +190,14 @@ }, { "default": "1", + "depends_on": "eval:doc.entry_type=='Decapitalization'", "fieldname": "target_qty", "fieldtype": "Float", "label": "Target Qty", "read_only_depends_on": "eval:doc.entry_type=='Capitalization'" }, { + "depends_on": "eval:doc.entry_type=='Decapitalization'", "fetch_from": "target_item_code.stock_uom", "fieldname": "target_stock_uom", "fieldtype": "Link", @@ -331,18 +337,26 @@ "read_only": 1 }, { - "depends_on": "eval:doc.entry_type=='Capitalization'", + "depends_on": "eval:doc.entry_type=='Capitalization' && doc.capitalization_method=='Create a new composite asset'", "fieldname": "target_asset_location", "fieldtype": "Link", "label": "Target Asset Location", - "mandatory_depends_on": "eval:doc.entry_type=='Capitalization'", + "mandatory_depends_on": "eval:doc.entry_type=='Capitalization' && doc.capitalization_method=='Create a new composite asset'", "options": "Location" + }, + { + "depends_on": "eval:doc.entry_type=='Capitalization'", + "fieldname": "capitalization_method", + "fieldtype": "Select", + "label": "Capitalization Method", + "mandatory_depends_on": "eval:doc.entry_type=='Capitalization'", + "options": "\nCreate a new composite asset\nChoose a WIP composite asset" } ], "index_web_pages_for_search": 1, "is_submittable": 1, "links": [], - "modified": "2023-06-22 14:17:07.995120", + "modified": "2023-10-03 22:55:59.461456", "modified_by": "Administrator", "module": "Assets", "name": "Asset Capitalization", diff --git a/erpnext/assets/doctype/asset_capitalization/asset_capitalization.py b/erpnext/assets/doctype/asset_capitalization/asset_capitalization.py index 44db6920c13..04654104c7a 100644 --- a/erpnext/assets/doctype/asset_capitalization/asset_capitalization.py +++ b/erpnext/assets/doctype/asset_capitalization/asset_capitalization.py @@ -53,6 +53,7 @@ class AssetCapitalization(StockController): self.validate_posting_time() self.set_missing_values(for_validate=True) self.validate_target_item() + self.validate_target_asset() self.validate_consumed_stock_item() self.validate_consumed_asset_item() self.validate_service_item() @@ -63,12 +64,12 @@ class AssetCapitalization(StockController): def before_submit(self): self.validate_source_mandatory() - if self.entry_type == "Capitalization": - self.create_target_asset() + self.create_target_asset() def on_submit(self): self.update_stock_ledger() self.make_gl_entries() + self.update_target_asset() def on_cancel(self): self.ignore_linked_doctypes = ("GL Entry", "Stock Ledger Entry", "Repost Item Valuation") @@ -85,6 +86,11 @@ class AssetCapitalization(StockController): if self.meta.has_field(k) and (not self.get(k) or k in force_fields): self.set(k, v) + target_asset_details = get_target_asset_details(self.target_asset, self.company) + for k, v in target_asset_details.items(): + if self.meta.has_field(k) and (not self.get(k) or k in force_fields): + self.set(k, v) + for d in self.stock_items: args = self.as_dict() args.update(d.as_dict()) @@ -146,6 +152,33 @@ class AssetCapitalization(StockController): self.validate_item(target_item) + def validate_target_asset(self): + if self.target_asset: + target_asset = self.get_asset_for_validation(self.target_asset) + + if not target_asset.is_composite_asset: + frappe.throw(_("Target Asset {0} needs to be composite asset").format(target_asset.name)) + + if target_asset.item_code != self.target_item_code: + frappe.throw( + _("Asset {0} does not belong to Item {1}").format(self.target_asset, self.target_item_code) + ) + + if target_asset.status in ("Scrapped", "Sold", "Capitalized", "Decapitalized"): + frappe.throw( + _("Target Asset {0} cannot be {1}").format(target_asset.name, target_asset.status) + ) + + if target_asset.docstatus == 1: + frappe.throw(_("Target Asset {0} cannot be submitted").format(target_asset.name)) + elif target_asset.docstatus == 2: + frappe.throw(_("Target Asset {0} cannot be cancelled").format(target_asset.name)) + + if target_asset.company != self.company: + frappe.throw( + _("Target Asset {0} does not belong to company {1}").format(target_asset.name, self.company) + ) + def validate_consumed_stock_item(self): for d in self.stock_items: if d.item_code: @@ -170,7 +203,23 @@ class AssetCapitalization(StockController): ) asset = self.get_asset_for_validation(d.asset) - self.validate_asset(asset) + + if asset.status in ("Draft", "Scrapped", "Sold", "Capitalized", "Decapitalized"): + frappe.throw( + _("Row #{0}: Consumed Asset {1} cannot be {2}").format(d.idx, asset.name, asset.status) + ) + + if asset.docstatus == 0: + frappe.throw(_("Row #{0}: Consumed Asset {1} cannot be Draft").format(d.idx, asset.name)) + elif asset.docstatus == 2: + frappe.throw(_("Row #{0}: Consumed Asset {1} cannot be cancelled").format(d.idx, asset.name)) + + if asset.company != self.company: + frappe.throw( + _("Row #{0}: Consumed Asset {1} does not belong to company {2}").format( + d.idx, asset.name, self.company + ) + ) def validate_service_item(self): for d in self.service_items: @@ -205,21 +254,12 @@ class AssetCapitalization(StockController): def get_asset_for_validation(self, asset): return frappe.db.get_value( - "Asset", asset, ["name", "item_code", "company", "status", "docstatus"], as_dict=1 + "Asset", + asset, + ["name", "item_code", "company", "status", "docstatus", "is_composite_asset"], + as_dict=1, ) - def validate_asset(self, asset): - if asset.status in ("Draft", "Scrapped", "Sold", "Capitalized", "Decapitalized"): - frappe.throw(_("Asset {0} is {1}").format(asset.name, asset.status)) - - if asset.docstatus == 0: - frappe.throw(_("Asset {0} is Draft").format(asset.name)) - if asset.docstatus == 2: - frappe.throw(_("Asset {0} is cancelled").format(asset.name)) - - if asset.company != self.company: - frappe.throw(_("Asset {0} does not belong to company {1}").format(asset.name, self.company)) - @frappe.whitelist() def set_warehouse_details(self): for d in self.get("stock_items"): @@ -485,16 +525,25 @@ class AssetCapitalization(StockController): ) def create_target_asset(self): + if ( + self.entry_type != "Capitalization" + or self.capitalization_method != "Create a new composite asset" + ): + return + total_target_asset_value = flt(self.total_value, self.precision("total_value")) + asset_doc = frappe.new_doc("Asset") asset_doc.company = self.company asset_doc.item_code = self.target_item_code - asset_doc.is_existing_asset = 1 + asset_doc.is_composite_asset = 1 asset_doc.location = self.target_asset_location asset_doc.available_for_use_date = self.posting_date asset_doc.purchase_date = self.posting_date asset_doc.gross_purchase_amount = total_target_asset_value asset_doc.purchase_receipt_amount = total_target_asset_value + asset_doc.purchase_receipt_amount = total_target_asset_value + asset_doc.capitalized_in = self.name asset_doc.flags.ignore_validate = True asset_doc.insert() @@ -510,6 +559,28 @@ class AssetCapitalization(StockController): ).format(get_link_to_form("Asset", asset_doc.name)) ) + def update_target_asset(self): + if ( + self.entry_type != "Capitalization" + or self.capitalization_method != "Choose a WIP composite asset" + ): + return + + total_target_asset_value = flt(self.total_value, self.precision("total_value")) + + asset_doc = frappe.get_doc("Asset", self.target_asset) + asset_doc.gross_purchase_amount = total_target_asset_value + asset_doc.purchase_receipt_amount = total_target_asset_value + asset_doc.capitalized_in = self.name + asset_doc.flags.ignore_validate = True + asset_doc.save() + + frappe.msgprint( + _( + "Asset {0} has been updated. Please set the depreciation details if any and submit it." + ).format(get_link_to_form("Asset", asset_doc.name)) + ) + def restore_consumed_asset_items(self): for item in self.asset_items: asset = frappe.get_doc("Asset", item.asset) @@ -568,6 +639,33 @@ def get_target_item_details(item_code=None, company=None): return out +@frappe.whitelist() +def get_target_asset_details(asset=None, company=None): + out = frappe._dict() + + # Get Asset Details + asset_details = frappe._dict() + if asset: + asset_details = frappe.db.get_value("Asset", asset, ["asset_name", "item_code"], as_dict=1) + if not asset_details: + frappe.throw(_("Asset {0} does not exist").format(asset)) + + # Re-set item code from Asset + out.target_item_code = asset_details.item_code + + # Set Asset Details + out.asset_name = asset_details.asset_name + + if asset_details.item_code: + out.target_fixed_asset_account = get_asset_category_account( + "fixed_asset_account", item=asset_details.item_code, company=company + ) + else: + out.target_fixed_asset_account = None + + return out + + @frappe.whitelist() def get_consumed_stock_item_details(args): if isinstance(args, string_types): @@ -716,3 +814,30 @@ def get_service_item_details(args): ) return out + + +@frappe.whitelist() +def get_items_tagged_to_wip_composite_asset(asset): + fields = [ + "item_code", + "item_name", + "batch_no", + "serial_no", + "stock_qty", + "stock_uom", + "warehouse", + "cost_center", + "qty", + "valuation_rate", + "amount", + ] + + pi_items = frappe.get_all( + "Purchase Invoice Item", filters={"wip_composite_asset": asset}, fields=fields + ) + + pr_items = frappe.get_all( + "Purchase Receipt Item", filters={"wip_composite_asset": asset}, fields=fields + ) + + return pi_items + pr_items diff --git a/erpnext/assets/doctype/asset_capitalization/test_asset_capitalization.py b/erpnext/assets/doctype/asset_capitalization/test_asset_capitalization.py index ead7abbf340..60c62d49afa 100644 --- a/erpnext/assets/doctype/asset_capitalization/test_asset_capitalization.py +++ b/erpnext/assets/doctype/asset_capitalization/test_asset_capitalization.py @@ -50,6 +50,7 @@ class TestAssetCapitalization(unittest.TestCase): # Create and submit Asset Captitalization asset_capitalization = create_asset_capitalization( entry_type="Capitalization", + capitalization_method="Create a new composite asset", target_item_code="Macbook Pro", target_asset_location="Test Location", stock_qty=stock_qty, @@ -139,6 +140,7 @@ class TestAssetCapitalization(unittest.TestCase): # Create and submit Asset Captitalization asset_capitalization = create_asset_capitalization( entry_type="Capitalization", + capitalization_method="Create a new composite asset", target_item_code="Macbook Pro", target_asset_location="Test Location", stock_qty=stock_qty, @@ -203,6 +205,77 @@ class TestAssetCapitalization(unittest.TestCase): self.assertFalse(get_actual_gle_dict(asset_capitalization.name)) self.assertFalse(get_actual_sle_dict(asset_capitalization.name)) + def test_capitalization_with_wip_composite_asset(self): + company = "_Test Company with perpetual inventory" + set_depreciation_settings_in_company(company=company) + + stock_rate = 1000 + stock_qty = 2 + stock_amount = 2000 + + total_amount = 2000 + + wip_composite_asset = create_asset( + asset_name="Asset Capitalization WIP Composite Asset", + is_composite_asset=1, + warehouse="Stores - TCP1", + company=company, + ) + + # Create and submit Asset Captitalization + asset_capitalization = create_asset_capitalization( + entry_type="Capitalization", + capitalization_method="Choose a WIP composite asset", + target_asset=wip_composite_asset, + target_asset_location="Test Location", + stock_qty=stock_qty, + stock_rate=stock_rate, + service_expense_account="Expenses Included In Asset Valuation - TCP1", + company=company, + submit=1, + ) + + # Test Asset Capitalization values + self.assertEqual(asset_capitalization.entry_type, "Capitalization") + self.assertEqual(asset_capitalization.capitalization_method, "Choose a WIP composite asset") + self.assertEqual(asset_capitalization.target_qty, 1) + + self.assertEqual(asset_capitalization.stock_items[0].valuation_rate, stock_rate) + self.assertEqual(asset_capitalization.stock_items[0].amount, stock_amount) + self.assertEqual(asset_capitalization.stock_items_total, stock_amount) + + self.assertEqual(asset_capitalization.total_value, total_amount) + self.assertEqual(asset_capitalization.target_incoming_rate, total_amount) + + # Test Target Asset values + target_asset = frappe.get_doc("Asset", asset_capitalization.target_asset) + self.assertEqual(target_asset.gross_purchase_amount, total_amount) + self.assertEqual(target_asset.purchase_receipt_amount, total_amount) + + # Test General Ledger Entries + expected_gle = { + "_Test Fixed Asset - TCP1": 2000, + "_Test Warehouse - TCP1": -2000, + } + actual_gle = get_actual_gle_dict(asset_capitalization.name) + + self.assertEqual(actual_gle, expected_gle) + + # Test Stock Ledger Entries + expected_sle = { + ("Capitalization Source Stock Item", "_Test Warehouse - TCP1"): { + "actual_qty": -stock_qty, + "stock_value_difference": -stock_amount, + } + } + actual_sle = get_actual_sle_dict(asset_capitalization.name) + self.assertEqual(actual_sle, expected_sle) + + # Cancel Asset Capitalization and make test entries and status are reversed + asset_capitalization.cancel() + self.assertFalse(get_actual_gle_dict(asset_capitalization.name)) + self.assertFalse(get_actual_sle_dict(asset_capitalization.name)) + def test_decapitalization_with_depreciation(self): # Variables purchase_date = "2020-01-01" @@ -326,6 +399,7 @@ def create_asset_capitalization(**args): asset_capitalization.update( { "entry_type": args.entry_type or "Capitalization", + "capitalization_method": args.capitalization_method or None, "company": company, "posting_date": args.posting_date or now.strftime("%Y-%m-%d"), "posting_time": args.posting_time or now.strftime("%H:%M:%S.%f"), diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js index 312c166f8b7..8966fbcbb3c 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js @@ -35,6 +35,12 @@ frappe.ui.form.on("Purchase Receipt", { } }); + frm.set_query("wip_composite_asset", "items", function() { + return { + filters: {'is_composite_asset': 1, 'docstatus': 0 } + } + }); + frm.set_query("taxes_and_charges", function() { return { filters: {'company': frm.doc.company } diff --git a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json index 76f476edf8a..4911523e7ed 100644 --- a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json +++ b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json @@ -110,6 +110,7 @@ "manufacturer_part_no", "accounting_details_section", "expense_account", + "wip_composite_asset", "column_break_102", "provisional_expense_account", "accounting_dimensions_section", @@ -1018,12 +1019,18 @@ "no_copy": 1, "print_hide": 1, "read_only": 1 + }, + { + "fieldname": "wip_composite_asset", + "fieldtype": "Link", + "label": "WIP Composite Asset", + "options": "Asset" } ], "idx": 1, "istable": 1, "links": [], - "modified": "2023-07-04 17:22:02.830029", + "modified": "2023-10-03 21:11:50.547261", "modified_by": "Administrator", "module": "Stock", "name": "Purchase Receipt Item", @@ -1034,4 +1041,4 @@ "sort_field": "modified", "sort_order": "DESC", "states": [] -} +} \ No newline at end of file From cf9fc552f0783afd66ade15461bb89f39d4abff1 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 4 Oct 2023 14:18:28 +0000 Subject: [PATCH 20/20] chore(release): Bumped to Version 14.43.0 # [14.43.0](https://github.com/frappe/erpnext/compare/v14.42.0...v14.43.0) (2023-10-04) ### Features * composite WIP asset (backport [#37352](https://github.com/frappe/erpnext/issues/37352)) ([#37360](https://github.com/frappe/erpnext/issues/37360)) ([6947686](https://github.com/frappe/erpnext/commit/69476861419f067ce6638063b3c2ca14ced04e7b)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index eb7d50ff198..25e95bb009a 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.42.0" +__version__ = "14.43.0" def get_default_company(user=None):