From 3eac0e907ea5a1ed584cea66e484b76bf2559acf Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 3 Jan 2024 06:01:15 +0000 Subject: [PATCH 01/40] chore(release): Bumped to Version 15.9.0 # [15.9.0](https://github.com/frappe/erpnext/compare/v15.8.3...v15.9.0) (2024-01-03) ### Bug Fixes * auto fetch not working if bundle exists (backport [#39002](https://github.com/frappe/erpnext/issues/39002)) ([#39004](https://github.com/frappe/erpnext/issues/39004)) ([2e91934](https://github.com/frappe/erpnext/commit/2e919344df8cd9018b2fff6d70b49c8db6ba0d8c)) * **DX:** capture tracebacks with context (backport [#39060](https://github.com/frappe/erpnext/issues/39060)) ([#39063](https://github.com/frappe/erpnext/issues/39063)) ([8ad7faf](https://github.com/frappe/erpnext/commit/8ad7fafe2ac6ca4a4cc9da39ca6ddf06dea42e99)) * enqueue demo data setup on setup complete (backport [#39043](https://github.com/frappe/erpnext/issues/39043)) ([#39044](https://github.com/frappe/erpnext/issues/39044)) ([d8cf994](https://github.com/frappe/erpnext/commit/d8cf994e94bec89897cde8ebf463637f850293f8)) * incorrect total when Accumulating values ([7c7c3c9](https://github.com/frappe/erpnext/commit/7c7c3c932fb8b8942d87b785f37e991c6c83818c)) * Multiple subscription fixes ([#39005](https://github.com/frappe/erpnext/issues/39005)) ([5158884](https://github.com/frappe/erpnext/commit/5158884dc9660cba1353b285e1eeb930ed9a204e)) * non stock uom validation for serial and batch (backport [#39018](https://github.com/frappe/erpnext/issues/39018)) ([#39026](https://github.com/frappe/erpnext/issues/39026)) ([89d1069](https://github.com/frappe/erpnext/commit/89d106947279b07073aa87a9678d9c655e562077)) * not able to cancel sales invoice (backport [#38979](https://github.com/frappe/erpnext/issues/38979)) ([#38980](https://github.com/frappe/erpnext/issues/38980)) ([f8625f3](https://github.com/frappe/erpnext/commit/f8625f3eb7e60b3985de900f7443864c7dec20e3)) * on cancellation of document cancel the serial and batch bundle (backport [#39076](https://github.com/frappe/erpnext/issues/39076)) ([#39082](https://github.com/frappe/erpnext/issues/39082)) ([2e0abbd](https://github.com/frappe/erpnext/commit/2e0abbd2748eec7020708a06b9b30486f177e75a)) * Opening balance in bank reconciliation tool ([#38977](https://github.com/frappe/erpnext/issues/38977)) ([e0755f9](https://github.com/frappe/erpnext/commit/e0755f9a9a7d57ce4dd4c4c4c5954c56bc3fe13a)) * purchase return without item code not working (backport [#39014](https://github.com/frappe/erpnext/issues/39014)) ([#39015](https://github.com/frappe/erpnext/issues/39015)) ([2a390ac](https://github.com/frappe/erpnext/commit/2a390ac2de0905b479fa237a852a27121f6924ba)) * remove bad defaults (backport [#38986](https://github.com/frappe/erpnext/issues/38986)) ([#38988](https://github.com/frappe/erpnext/issues/38988)) ([46035ed](https://github.com/frappe/erpnext/commit/46035ed9cab2b150e88a31be79b839f910aca24e)) * select options should dynamically load dimensions ([21f9001](https://github.com/frappe/erpnext/commit/21f90011bcbe00ba545cd9460a5cab8965c6f886)) * serial and batch bundle company mandatory error (backport [#38994](https://github.com/frappe/erpnext/issues/38994)) ([#38999](https://github.com/frappe/erpnext/issues/38999)) ([d2580be](https://github.com/frappe/erpnext/commit/d2580be4fd0a08aeddbdbf9b87d99b71a45d7820)) * take quantity into account when setting asset's gross purchase amt (backport [#39056](https://github.com/frappe/erpnext/issues/39056)) ([#39058](https://github.com/frappe/erpnext/issues/39058)) ([2e93275](https://github.com/frappe/erpnext/commit/2e932754e079d29b88335fdc0d6d3d192d2c149c)) * Unable to save Sales Invoice ([#39059](https://github.com/frappe/erpnext/issues/39059)) ([73c0f37](https://github.com/frappe/erpnext/commit/73c0f3703cd57100a86b750bbfd1a37a2878d3b9)) * undefined error in Budget Variance and Profitability report ([9fdf5c8](https://github.com/frappe/erpnext/commit/9fdf5c8091933de39431ffe2315ad6e24a6faf90)) * undefined error in consolidated financial report ([49f93f9](https://github.com/frappe/erpnext/commit/49f93f9fa1ce17838c66873771f9b943a4575102)) * use `Stock Qty` while getting `POS Reserved Qty` (backport [#38962](https://github.com/frappe/erpnext/issues/38962)) ([#38965](https://github.com/frappe/erpnext/issues/38965)) ([76c6b50](https://github.com/frappe/erpnext/commit/76c6b501f91a0550a554be94ec66e6ebd89ef40f)) * Validate account in Sales/Purchase Taxes and Charges Template ([#39013](https://github.com/frappe/erpnext/issues/39013)) ([f3254c2](https://github.com/frappe/erpnext/commit/f3254c201000a822dab2dde2b6340f04051cbd4a)) * work order with multi level, fetch operting cost from sub-assembly (backport [#38992](https://github.com/frappe/erpnext/issues/38992)) ([#39028](https://github.com/frappe/erpnext/issues/39028)) ([3a7506e](https://github.com/frappe/erpnext/commit/3a7506ecbcc369bcf1cb10db49d4e93f4e3cf7a4)) ### Features * Against voucher filter in General Ledger ([#39102](https://github.com/frappe/erpnext/issues/39102)) ([458064f](https://github.com/frappe/erpnext/commit/458064f8a16507fcfb5684c783ebb9dc85c4ee01)) * group by Asset in Asset Depreciations and Balances report (backport [#38923](https://github.com/frappe/erpnext/issues/38923)) ([#39066](https://github.com/frappe/erpnext/issues/39066)) ([d85dad7](https://github.com/frappe/erpnext/commit/d85dad719806146032c10a1c4b032cfb22ebbe1d)) * Merge taxes from mapped docs ([#38346](https://github.com/frappe/erpnext/issues/38346)) ([4e23048](https://github.com/frappe/erpnext/commit/4e2304818b432f3ab5bf22268267cebf2266b117)) * voucher subtype for general ledger ([#38822](https://github.com/frappe/erpnext/issues/38822)) ([e5d73c7](https://github.com/frappe/erpnext/commit/e5d73c780bc5e272dd7c3db7db65665010ef6623)) ### Performance Improvements * index item_code in bom explosion item (backport [#39085](https://github.com/frappe/erpnext/issues/39085)) ([#39088](https://github.com/frappe/erpnext/issues/39088)) ([57bcf9f](https://github.com/frappe/erpnext/commit/57bcf9f56890f3e3f2cb30ec5c54279fc00c8dca)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 888160baf4..ff8105e755 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "15.8.3" +__version__ = "15.9.0" def get_default_company(user=None): From 5ee6cc4bacf207ae48d4cd1d5678c1a5fc84801c Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 3 Jan 2024 17:59:15 +0530 Subject: [PATCH 02/40] fix: typerror on multi select dialog (cherry picked from commit 7da9ffa3bd072fbfc9627e6eb5afb3dd3078f560) --- erpnext/public/js/utils.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js index 866e94f95a..598167b337 100755 --- a/erpnext/public/js/utils.js +++ b/erpnext/public/js/utils.js @@ -865,16 +865,20 @@ erpnext.utils.map_current_doc = function(opts) { } if (opts.source_doctype) { + let data_fields = []; + if(opts.source_doctype == "Purchase Receipt") { + data_fields.push({ + fieldname: 'merge_taxes', + fieldtype: 'Check', + label: __('Merge taxes from multiple documents'), + }); + } const d = new frappe.ui.form.MultiSelectDialog({ doctype: opts.source_doctype, target: opts.target, date_field: opts.date_field || undefined, setters: opts.setters, - data_fields: [{ - fieldname: 'merge_taxes', - fieldtype: 'Check', - label: __('Merge taxes from multiple documents'), - }], + data_fields: data_fields, get_query: opts.get_query, add_filters_group: 1, allow_child_item_selection: opts.allow_child_item_selection, @@ -888,7 +892,10 @@ erpnext.utils.map_current_doc = function(opts) { return; } opts.source_name = values; - opts.args = args; + if (opts.allow_child_item_selection || opts.source_doctype == "Purchase Receipt") { + // args contains filtered child docnames + opts.args = args; + } d.dialog.hide(); _map(); }, From 290397172e5e0e49b71385e516dee72c8b975d54 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 3 Jan 2024 15:37:59 +0000 Subject: [PATCH 03/40] chore(release): Bumped to Version 15.9.1 ## [15.9.1](https://github.com/frappe/erpnext/compare/v15.9.0...v15.9.1) (2024-01-03) ### Bug Fixes * typerror on multi select dialog ([5ee6cc4](https://github.com/frappe/erpnext/commit/5ee6cc4bacf207ae48d4cd1d5678c1a5fc84801c)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index ff8105e755..e598266f3c 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "15.9.0" +__version__ = "15.9.1" def get_default_company(user=None): From 1dc85fcaf874b6c6f8822a8a1e974bf374f27900 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 10 Jan 2024 10:36:08 +0000 Subject: [PATCH 04/40] chore(release): Bumped to Version 15.10.0 # [15.10.0](https://github.com/frappe/erpnext/compare/v15.9.1...v15.10.0) (2024-01-10) ### Bug Fixes * add expected_start_date in sort by ([b064944](https://github.com/frappe/erpnext/commit/b06494475303bbd50428322060605105e9aec09f)) * Add name to Hungary - Chart of Accounts for Microenterprises json ([0784488](https://github.com/frappe/erpnext/commit/0784488eeced2b3710ddc92f0824ea952de0f937)) * add read permission to Buying Settings ([e62dd0d](https://github.com/frappe/erpnext/commit/e62dd0d7cb258c011fdc9b21fba4bb0b0bb08e28)) * bank transction status upon reconciliation ([277aa7b](https://github.com/frappe/erpnext/commit/277aa7bc2bd37aa721a0fa4fcf7b85217b84236b)) * BOM replace tool does not update exploded items of root (backport [#39244](https://github.com/frappe/erpnext/issues/39244)) ([#39250](https://github.com/frappe/erpnext/issues/39250)) ([0898ea5](https://github.com/frappe/erpnext/commit/0898ea5d927600972ac45fd6d763cf53cafdf29a)) * Creating Asset Activity while Importing Asset ([#39113](https://github.com/frappe/erpnext/issues/39113)) ([5e46937](https://github.com/frappe/erpnext/commit/5e4693763ae7f8dde2013093d926d6abd39fd174)) * don't set rate for non-stock item in Internal Transfer (backport [#39140](https://github.com/frappe/erpnext/issues/39140)) ([#39169](https://github.com/frappe/erpnext/issues/39169)) ([f3882a8](https://github.com/frappe/erpnext/commit/f3882a854ff2d412e2e538121baae88c58a7894a)) * Duplicate Closing Stock Balance (backport [#39262](https://github.com/frappe/erpnext/issues/39262)) ([#39264](https://github.com/frappe/erpnext/issues/39264)) ([78c65f2](https://github.com/frappe/erpnext/commit/78c65f27b0d0622542a2e0d90fc8f1a45767f4fd)) * duplicate entry for serial / batch creation (backport [#39188](https://github.com/frappe/erpnext/issues/39188)) ([#39192](https://github.com/frappe/erpnext/issues/39192)) ([672e6d6](https://github.com/frappe/erpnext/commit/672e6d6d06f51aed146e1d5d3cf721c4fbc6394b)) * **Employee:** treeview ([#39126](https://github.com/frappe/erpnext/issues/39126)) ([6020c8e](https://github.com/frappe/erpnext/commit/6020c8e8f718d2ab4c75104891a4a268302901af)) * FG Item incorrect qty in the work order (backport [#39200](https://github.com/frappe/erpnext/issues/39200)) ([#39211](https://github.com/frappe/erpnext/issues/39211)) ([abc99f8](https://github.com/frappe/erpnext/commit/abc99f84e9fa5332cd7bf8d126de5bff5a63f09f)) * flaky demo test case (backport [#39135](https://github.com/frappe/erpnext/issues/39135)) ([#39198](https://github.com/frappe/erpnext/issues/39198)) ([3caf462](https://github.com/frappe/erpnext/commit/3caf462c6b42b9c8d5b8b0a407c54c749474a334)) * Ignore asset qty and status validation while cancelling LCV ([87d1b0f](https://github.com/frappe/erpnext/commit/87d1b0f476ecc475050289c29d8c8026c99e3d90)) * ignore cancelled payments in Sales/Purchase Register ([9e1b443](https://github.com/frappe/erpnext/commit/9e1b443857ec92ea2aa53f2801622b2743f181fb)) * Ignore UP on "allowed to transact with" ([#39103](https://github.com/frappe/erpnext/issues/39103)) ([aad39cf](https://github.com/frappe/erpnext/commit/aad39cf6868bcfd1dfbc4a54d2c9432ee052c8bf)) * improved validation message ([e89dce7](https://github.com/frappe/erpnext/commit/e89dce726b3e6b97a87d111f2f0a09797dc825d1)) * incorrect indicator title for portal sales order (backport [#39247](https://github.com/frappe/erpnext/issues/39247)) ([#39255](https://github.com/frappe/erpnext/issues/39255)) ([9f793b9](https://github.com/frappe/erpnext/commit/9f793b9b2886d8f1ef7dca0086deede5132664b8)) * incorrect outstanding amt validation on advance as liability ([51d8a7a](https://github.com/frappe/erpnext/commit/51d8a7a0c1726130518e44b47cce387e90c2a6c7)) * Introduced company field to show amounts in company currency ([1d2e831](https://github.com/frappe/erpnext/commit/1d2e831846adfd94d1a57fd98703450ccab7f574)) * inventory dimension negative stock validation (backport [#39149](https://github.com/frappe/erpnext/issues/39149)) ([#39151](https://github.com/frappe/erpnext/issues/39151)) ([82b96d3](https://github.com/frappe/erpnext/commit/82b96d3688b72493d613b3e9be1b40193bbec8d9)) * possible key error on Financial ratios report ([16269b0](https://github.com/frappe/erpnext/commit/16269b0730fccaa95eb35ed1381eef54236f6211)) * possible typeerror on transaction.js ([fec892c](https://github.com/frappe/erpnext/commit/fec892c21100d64d47fe71fd26d1b3130d417b64)) * projects website list visible for guests and all logged in customers (backport [#39164](https://github.com/frappe/erpnext/issues/39164)) ([#39273](https://github.com/frappe/erpnext/issues/39273)) ([5d6bc96](https://github.com/frappe/erpnext/commit/5d6bc9637599b58826177d32e53cf8f7ea73fdfb)), closes [#39009](https://github.com/frappe/erpnext/issues/39009) * Purchase date and amount is not mandatory for composite asset creation ([d6d54ed](https://github.com/frappe/erpnext/commit/d6d54ed220d86a1861ddace26f6e133247bedc7a)) * Resolved conflict ([afefae0](https://github.com/frappe/erpnext/commit/afefae08afa57d68fc72b1ee385b3c315878e8b1)) * serial / batch barcode scanner (backport [#39114](https://github.com/frappe/erpnext/issues/39114)) ([#39143](https://github.com/frappe/erpnext/issues/39143)) ([2db1e1a](https://github.com/frappe/erpnext/commit/2db1e1a737ed47be7d74fae08af0621953b1e032)) * Set asset purchase amount based on qty and valuation_rate ([f0070b4](https://github.com/frappe/erpnext/commit/f0070b4046e07ec65c751dc4024bf56da931d3d5)) * set parent doctype on chart (backport [#39286](https://github.com/frappe/erpnext/issues/39286)) ([#39288](https://github.com/frappe/erpnext/issues/39288)) ([fe973a4](https://github.com/frappe/erpnext/commit/fe973a4b53ab256c9c3c3386466bd8edd007dd8f)) * Show maintain-stock and is-fixed-asset checkbox in item quick entry dialog ([50300b9](https://github.com/frappe/erpnext/commit/50300b9be6b30e25a6d48441d32e22fc3bf995fe)) * Show timesheet table after fetching data from timesheet (backport [#39275](https://github.com/frappe/erpnext/issues/39275)) ([#39281](https://github.com/frappe/erpnext/issues/39281)) ([2598f8e](https://github.com/frappe/erpnext/commit/2598f8e7ec082fdfd3b9ee18600ec5cfd6024e4c)) * skip rate validation for return `DN Items` with `Moving Average` valuation (backport [#39242](https://github.com/frappe/erpnext/issues/39242)) ([#39266](https://github.com/frappe/erpnext/issues/39266)) ([f00a6f6](https://github.com/frappe/erpnext/commit/f00a6f6c59f910cd857e258a47719085fa0acf0d)) * Subscription update patch ([7640fea](https://github.com/frappe/erpnext/commit/7640feaaa7b44a7347aaa16ca8742b500b9faddd)) * total allocated percentage for sales team issue ([756c062](https://github.com/frappe/erpnext/commit/756c062733a3f0f34ffd9c828d926d9bf20a44bf)) * TypeError is pricing rules (backport [#39252](https://github.com/frappe/erpnext/issues/39252)) ([#39260](https://github.com/frappe/erpnext/issues/39260)) ([bb6025c](https://github.com/frappe/erpnext/commit/bb6025ca2608ac8895fc5da8d92004b7699f0827)) * typerror on multi select dialog ([54a0df5](https://github.com/frappe/erpnext/commit/54a0df51645a166d1adf1b95d9015c1e6a26af86)) * update Maintenance Schedule status on Maintenance Visit submit (backport [#39167](https://github.com/frappe/erpnext/issues/39167)) ([#39186](https://github.com/frappe/erpnext/issues/39186)) ([926850d](https://github.com/frappe/erpnext/commit/926850d1f6443f1544acb92c2837eb5465dd49a5)) * update status on manual allocation ([a147e29](https://github.com/frappe/erpnext/commit/a147e2954f1fede707a1a1a19fc1779fec2022f9)) * **UX:** dont override framework's permission check messages (backport [#39118](https://github.com/frappe/erpnext/issues/39118)) ([#39120](https://github.com/frappe/erpnext/issues/39120)) ([40ec5ff](https://github.com/frappe/erpnext/commit/40ec5ff90f9b07a61baa98fa9665922162e3c235)) ### Features * provision to close SCO (backport [#39127](https://github.com/frappe/erpnext/issues/39127)) ([#39144](https://github.com/frappe/erpnext/issues/39144)) ([b192ddd](https://github.com/frappe/erpnext/commit/b192ddd13b7d615fff6d7df883c793207b8e6c76)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index e598266f3c..49bc8d31c5 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "15.9.1" +__version__ = "15.10.0" def get_default_company(user=None): From b8f4c3193ab24def8b7daad1a1fa8a0817779c96 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Sat, 13 Jan 2024 10:25:53 +0530 Subject: [PATCH 05/40] fix: SBB Total Qty validation for SE (backport #39335) (backport #39348) (#39353) fix: SBB Total Qty validation for SE (cherry picked from commit c20241fcb5d7269c08c38f51c92bf73289650708) (cherry picked from commit ca18853785757380a6070f36c0d907693de6b167) Co-authored-by: s-aga-r --- erpnext/controllers/stock_controller.py | 6 +----- .../serial_and_batch_bundle/serial_and_batch_bundle.py | 4 +++- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py index fd417f3270..a86d7388df 100644 --- a/erpnext/controllers/stock_controller.py +++ b/erpnext/controllers/stock_controller.py @@ -387,11 +387,7 @@ class StockController(AccountsController): } for row in self.get(table_name): - for field in [ - "serial_and_batch_bundle", - "current_serial_and_batch_bundle", - "rejected_serial_and_batch_bundle", - ]: + for field in QTY_FIELD.keys(): if row.get(field): frappe.get_doc("Serial and Batch Bundle", row.get(field)).set_serial_and_batch_values( self, row, qty_field=QTY_FIELD[field] diff --git a/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py b/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py index 620b9606a7..2b87fcd175 100644 --- a/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py +++ b/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py @@ -490,8 +490,10 @@ class SerialandBatchBundle(Document): qty_field = "qty" precision = row.precision - if row.get("doctype") in ["Subcontracting Receipt Supplied Item"]: + if row.get("doctype") == "Subcontracting Receipt Supplied Item": qty_field = "consumed_qty" + elif row.get("doctype") == "Stock Entry Detail": + qty_field = "transfer_qty" qty = row.get(qty_field) if qty_field == "qty" and row.get("stock_qty"): From 1503ba92e3691f52fd3a3a1c2b52b19adb5cfe23 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 15 Jan 2024 12:12:35 +0530 Subject: [PATCH 06/40] ci: bump node in release workflow (backport #39377) (backport #39378) (#39380) ci: bump node in release workflow (backport #39377) (#39378) * ci: bump node in release workflow (cherry picked from commit aef87cced7da0524c7ca2dadfcd111aaf13ef0c2) # Conflicts: # .github/workflows/release.yml * chore: `conflicts` --------- Co-authored-by: s-aga-r (cherry picked from commit e282ba78c179a7b6893d120e7d5db3d90baed72c) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4546a69668..5f0abc70c5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,7 +17,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v2 with: - node-version: 18 + node-version: 20 - name: Setup dependencies run: | From 8a356cbe51d23101a40b59b97ef91e5c18aedb18 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Mon, 15 Jan 2024 06:47:45 +0000 Subject: [PATCH 07/40] chore(release): Bumped to Version 15.10.1 ## [15.10.1](https://github.com/frappe/erpnext/compare/v15.10.0...v15.10.1) (2024-01-15) ### Bug Fixes * SBB Total Qty validation for SE (backport [#39335](https://github.com/frappe/erpnext/issues/39335)) (backport [#39348](https://github.com/frappe/erpnext/issues/39348)) ([#39353](https://github.com/frappe/erpnext/issues/39353)) ([b8f4c31](https://github.com/frappe/erpnext/commit/b8f4c3193ab24def8b7daad1a1fa8a0817779c96)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 49bc8d31c5..183bec3dec 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "15.10.0" +__version__ = "15.10.1" def get_default_company(user=None): From d5c26efb8c06af52f89eb43aab3bfb45f5753b20 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 17 Jan 2024 17:06:29 +0000 Subject: [PATCH 08/40] chore(release): Bumped to Version 15.10.2 ## [15.10.2](https://github.com/frappe/erpnext/compare/v15.10.1...v15.10.2) (2024-01-17) ### Bug Fixes * added indexing to improve performance ([50fe419](https://github.com/frappe/erpnext/commit/50fe4191d37172381f1a41b7fec1abbc4d1a2b56)) * added item group in stock reco ([eec6c25](https://github.com/frappe/erpnext/commit/eec6c25f9e386294d08b44430219de385050856b)) * Asset module tests ([9e33216](https://github.com/frappe/erpnext/commit/9e33216c24d211056ddfe444a3ac5f18983f3cd9)) * asset WDV depreciation calc according to IT act ([2448ba6](https://github.com/frappe/erpnext/commit/2448ba6bc4da574907101b4d6b9ebd79e9a1d8d9)) * batches not coming correctly in the batch selector ([1394a1c](https://github.com/frappe/erpnext/commit/1394a1c5e99a9d5d50c3fa839f40b376aa55a8e0)) * broken dimension filters in Sales/Purchase register ([04037b7](https://github.com/frappe/erpnext/commit/04037b7e386bc7a0fb178d5e1fa232b951435d2a)) * Cancel asset capitalisation record on cancellation of asset and vice-versa ([011c5a6](https://github.com/frappe/erpnext/commit/011c5a69f0af1d129e3de12da651074cf6817a3e)) * circular dependency error while deleting QC ([7ca8e49](https://github.com/frappe/erpnext/commit/7ca8e49b389b68e07c81fcf8e38aa830767fd04a)) * composite asset capitalization using asset components ([8bc8bc1](https://github.com/frappe/erpnext/commit/8bc8bc1822bb2681497c414979424efe0e74bd23)) * consider all years in holiday list ([21eed78](https://github.com/frappe/erpnext/commit/21eed78fa1b7a8c6f8419aa29223301655e5a817)) * consistency in display reserved_stock checkbox on Sales Order Item according global settings and item.is_stock_item (backport [#38322](https://github.com/frappe/erpnext/issues/38322)) ([#39417](https://github.com/frappe/erpnext/issues/39417)) ([53f61f1](https://github.com/frappe/erpnext/commit/53f61f1ad171e42c694311191204e2b82bd91dbb)) * date in master document for dictionary condition ([9aae439](https://github.com/frappe/erpnext/commit/9aae439b1f773ce634c41fe4d63a57169978b23a)) * fetch name for fy ([53208df](https://github.com/frappe/erpnext/commit/53208dfb3e67fd18626a447826a3152624c0287f)) * Ignore default payment terms template for opening invoices ([5dc2e80](https://github.com/frappe/erpnext/commit/5dc2e80987f2d8fea0513f05bcd5006f5d13da08)) * incorrect percentage received in purchase invoice ([758b9b8](https://github.com/frappe/erpnext/commit/758b9b8a81d018933702b1929b6041613b0922b7)) * incorrect sql error if account name has '%' ([b43f703](https://github.com/frappe/erpnext/commit/b43f70325c89f2b18e9e8467ccd7e6c8971794f3)) * modified date ([cd870ee](https://github.com/frappe/erpnext/commit/cd870ee30ca0004e66b094dbc51aa2943cd40a0e)) * modified date ([f048017](https://github.com/frappe/erpnext/commit/f0480173fbac4ec727ca4e75fe79b896e2947c25)) * modified date was not set ([2dc8686](https://github.com/frappe/erpnext/commit/2dc8686a81509dfcc93936a690f34a5892d0b39c)) * modified date was not updated ([61595c7](https://github.com/frappe/erpnext/commit/61595c7ede5ed4c61b9ca2cd28f7dd7e901997c1)) * performance issue related to stock entry (backport [#39301](https://github.com/frappe/erpnext/issues/39301)) ([#39303](https://github.com/frappe/erpnext/issues/39303)) ([d882305](https://github.com/frappe/erpnext/commit/d882305c72fbe10f2c096a52345128a32e1ac019)) * permission issue for the BIN ([8816b27](https://github.com/frappe/erpnext/commit/8816b2740acefdb468fa370524b0ba3a9d4f0399)) * possible typerror in utils.js ([80956b7](https://github.com/frappe/erpnext/commit/80956b795605dbb8ff04420e6e735acf1bf504b6)) * project filters on Delivery Note and Sales Order ([a51f956](https://github.com/frappe/erpnext/commit/a51f956f3e8cc8285350335bffa7b0e7706a8b27)) * project query controller logic ([07e2901](https://github.com/frappe/erpnext/commit/07e2901e4b47fbcba86ed1c5fc290097398aeb31)) * reset default after test ([e6f3a14](https://github.com/frappe/erpnext/commit/e6f3a14289e8a52864792bd9498eca3f31077ba7)) * SBB Total Qty validation for SE ([ca18853](https://github.com/frappe/erpnext/commit/ca18853785757380a6070f36c0d907693de6b167)) * test for asset depreciation ([ff1647a](https://github.com/frappe/erpnext/commit/ff1647a1d294793be3fb5f36b8931b4669858dda)) * **test:** test case for project query ([1b8f572](https://github.com/frappe/erpnext/commit/1b8f572e802186f8b5e6396f8634c0076625ef35)) * unreconcile Bank Transaction on cancel of payment voucher ([16860c2](https://github.com/frappe/erpnext/commit/16860c228da0a3452fa89dcae6fe169698c6ddbe)) * Update subscription period ([e219042](https://github.com/frappe/erpnext/commit/e219042304229c96a6be9694ee96bcbe5c544946)) * use child table values instead of global min max ([04c96dd](https://github.com/frappe/erpnext/commit/04c96ddc6c1337547f479a0874816d4faacfb80d)) * WDV as per IT Act: calculate yearly amount first and then split it based on months ([e3cd35b](https://github.com/frappe/erpnext/commit/e3cd35b9594f78cfcccab1472cb9ba4bc9ba3632)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 183bec3dec..3741ca689b 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "15.10.1" +__version__ = "15.10.2" def get_default_company(user=None): From 0c222aa50435d66520f3d504eda2008ea8926cd1 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Wed, 17 Jan 2024 20:52:16 +0530 Subject: [PATCH 09/40] fix: duplicate name error while making variant (cherry picked from commit d7e6b83e6432a6c46ce6e374252d25c0438c2205) (cherry picked from commit b649c50eccc3280168a7a69523d1aac829f4f71a) --- erpnext/controllers/item_variant.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/erpnext/controllers/item_variant.py b/erpnext/controllers/item_variant.py index ea7fb23cb6..1eee9eaa9d 100644 --- a/erpnext/controllers/item_variant.py +++ b/erpnext/controllers/item_variant.py @@ -56,7 +56,11 @@ def make_variant_based_on_manufacturer(template, manufacturer, manufacturer_part copy_attributes_to_variant(template, variant) - variant.item_code = append_number_if_name_exists("Item", template.name) + variant_name = f"{template.name} - {manufacturer}" + if manufacturer_part_no: + variant_name += f" - {manufacturer_part_no}" + + variant.item_code = append_number_if_name_exists("Item", variant_name) variant.flags.ignore_mandatory = True variant.save() From 550213b4f446330e9f6d3912d5c92fd54f66f3b7 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Fri, 19 Jan 2024 00:44:51 +0000 Subject: [PATCH 10/40] chore(release): Bumped to Version 15.10.3 ## [15.10.3](https://github.com/frappe/erpnext/compare/v15.10.2...v15.10.3) (2024-01-19) ### Bug Fixes * duplicate name error while making variant ([0c222aa](https://github.com/frappe/erpnext/commit/0c222aa50435d66520f3d504eda2008ea8926cd1)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 3741ca689b..4e99c5e0a8 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "15.10.2" +__version__ = "15.10.3" def get_default_company(user=None): From 028ae5b34ff558da436155814bc9f2fc83ea08a6 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Tue, 23 Jan 2024 11:59:22 +0000 Subject: [PATCH 11/40] chore(release): Bumped to Version 15.10.4 ## [15.10.4](https://github.com/frappe/erpnext/compare/v15.10.3...v15.10.4) (2024-01-23) ### Bug Fixes * added button to make serial / batch from Purchase Invoice ([96e1db8](https://github.com/frappe/erpnext/commit/96e1db80ac0d864d6454b6c3ad45ff8e6994b222)) * auto create serial no on scan ([ca93f67](https://github.com/frappe/erpnext/commit/ca93f671df5f31468c2d39bdc0f500fe0860a525)) * duplicate name error while making variant ([b649c50](https://github.com/frappe/erpnext/commit/b649c50eccc3280168a7a69523d1aac829f4f71a)) * key error during reposting ([b4981f8](https://github.com/frappe/erpnext/commit/b4981f8816071eaab346801e60aaf7ea850fa787)) * linting issue ([86f3f62](https://github.com/frappe/erpnext/commit/86f3f62e009ff1aae0979c8f084ad55046b06ae2)) * party field in pdf html ([9a08349](https://github.com/frappe/erpnext/commit/9a0834987cae93428f5daa813d09c19262fd0ad0)) * set unallocated amount after base tax ([74613c7](https://github.com/frappe/erpnext/commit/74613c7fe822f06448ea8595a048390b58c8f5bb)) * UOM needs to be whole number not being checked in quotations ([c7d5857](https://github.com/frappe/erpnext/commit/c7d58570144da48c993f76140f12f2f72b1e2b43)) * use most reliable section reference per report line ([b388adc](https://github.com/frappe/erpnext/commit/b388adcb2e49a96a2233c29de42ac274be0b2113)) * UX improvements for Serial and Batch Bundle ([c761459](https://github.com/frappe/erpnext/commit/c76145985d0962272756814ecbdb12bf2c68a6ab)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 4e99c5e0a8..c16a517a1c 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "15.10.3" +__version__ = "15.10.4" def get_default_company(user=None): From 3549cd39f14c15ead73e7b131d3cf1ab16a64a15 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 24 Jan 2024 11:42:37 +0530 Subject: [PATCH 12/40] fix: AttributeError in company transaction deletion (cherry picked from commit b127aa308eeda0246cdf885c36f0b36f270e2ae1) --- erpnext/setup/doctype/company/company.py | 2 +- .../test_transaction_deletion_record.py | 21 ++++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py index 27d7df33a3..a91fd01c91 100644 --- a/erpnext/setup/doctype/company/company.py +++ b/erpnext/setup/doctype/company/company.py @@ -911,8 +911,8 @@ def generate_id_for_deletion_job(company): @frappe.whitelist() def is_deletion_job_running(company): job_id = generate_id_for_deletion_job(company) - job_name = get_job(job_id).get_id() # job name will have site prefix if is_job_enqueued(job_id): + job_name = get_job(job_id).get_id() # job name will have site prefix frappe.throw( _("A Transaction Deletion Job: {0} is already running for {1}").format( frappe.bold(get_link_to_form("RQ Job", job_name)), frappe.bold(company) diff --git a/erpnext/setup/doctype/transaction_deletion_record/test_transaction_deletion_record.py b/erpnext/setup/doctype/transaction_deletion_record/test_transaction_deletion_record.py index 319d435ca6..844e7865e3 100644 --- a/erpnext/setup/doctype/transaction_deletion_record/test_transaction_deletion_record.py +++ b/erpnext/setup/doctype/transaction_deletion_record/test_transaction_deletion_record.py @@ -4,9 +4,10 @@ import unittest import frappe +from frappe.tests.utils import FrappeTestCase -class TestTransactionDeletionRecord(unittest.TestCase): +class TestTransactionDeletionRecord(FrappeTestCase): def setUp(self): create_company("Dunder Mifflin Paper Co") @@ -14,7 +15,7 @@ class TestTransactionDeletionRecord(unittest.TestCase): frappe.db.rollback() def test_doctypes_contain_company_field(self): - tdr = create_transaction_deletion_request("Dunder Mifflin Paper Co") + tdr = create_transaction_deletion_doc("Dunder Mifflin Paper Co") for doctype in tdr.doctypes: contains_company = False doctype_fields = frappe.get_meta(doctype.doctype_name).as_dict()["fields"] @@ -27,17 +28,27 @@ class TestTransactionDeletionRecord(unittest.TestCase): def test_no_of_docs_is_correct(self): for i in range(5): create_task("Dunder Mifflin Paper Co") - tdr = create_transaction_deletion_request("Dunder Mifflin Paper Co") + tdr = create_transaction_deletion_doc("Dunder Mifflin Paper Co") for doctype in tdr.doctypes: if doctype.doctype_name == "Task": self.assertEqual(doctype.no_of_docs, 5) def test_deletion_is_successful(self): create_task("Dunder Mifflin Paper Co") - create_transaction_deletion_request("Dunder Mifflin Paper Co") + create_transaction_deletion_doc("Dunder Mifflin Paper Co") tasks_containing_company = frappe.get_all("Task", filters={"company": "Dunder Mifflin Paper Co"}) self.assertEqual(tasks_containing_company, []) + def test_company_transaction_deletion_request(self): + from erpnext.setup.doctype.company.company import create_transaction_deletion_request + + # don't reuse below company for other test cases + company = "Deep Space Exploration" + create_company(company) + + # below call should not raise any exceptions or throw errors + create_transaction_deletion_request(company) + def create_company(company_name): company = frappe.get_doc( @@ -46,7 +57,7 @@ def create_company(company_name): company.insert(ignore_if_duplicate=True) -def create_transaction_deletion_request(company): +def create_transaction_deletion_doc(company): tdr = frappe.get_doc({"doctype": "Transaction Deletion Record", "company": company}) tdr.insert() tdr.submit() From cc195777f4ac85dd69cd370a683fba5f4210bc32 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 24 Jan 2024 07:59:52 +0000 Subject: [PATCH 13/40] chore(release): Bumped to Version 15.10.5 ## [15.10.5](https://github.com/frappe/erpnext/compare/v15.10.4...v15.10.5) (2024-01-24) ### Bug Fixes * AttributeError in company transaction deletion ([3549cd3](https://github.com/frappe/erpnext/commit/3549cd39f14c15ead73e7b131d3cf1ab16a64a15)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index c16a517a1c..9ac3ce7e61 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "15.10.4" +__version__ = "15.10.5" def get_default_company(user=None): From 83c120849f4780d2bfd79a6a0a69ec09b1b40f04 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Wed, 24 Jan 2024 23:45:06 +0530 Subject: [PATCH 14/40] fix: Item Tax template is not working for e-commerce (cherry picked from commit 7d3240ae3a2e8fc761d460793fbddfb2b5cffc09) (cherry picked from commit 2905db19e5f28aa3b5ad97d93451d6e0703bfb25) --- erpnext/controllers/accounts_controller.py | 32 +++++++++++ .../doctype/quotation/test_quotation.py | 55 +++++++++++++++++++ 2 files changed, 87 insertions(+) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 6b1be396d2..83a75fafb2 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -21,6 +21,7 @@ from frappe.utils import ( get_link_to_form, getdate, nowdate, + parse_json, today, ) @@ -831,6 +832,37 @@ class AccountsController(TransactionBase): self.extend("taxes", get_taxes_and_charges(tax_master_doctype, self.get("taxes_and_charges"))) + def append_taxes_from_item_tax_template(self): + if not frappe.db.get_single_value("Accounts Settings", "add_taxes_from_item_tax_template"): + return + + for row in self.items: + item_tax_rate = row.get("item_tax_rate") + if not item_tax_rate: + continue + + if isinstance(item_tax_rate, str): + item_tax_rate = parse_json(item_tax_rate) + + for account_head, rate in item_tax_rate.items(): + row = self.get_tax_row(account_head) + + if not row: + self.append( + "taxes", + { + "charge_type": "On Net Total", + "account_head": account_head, + "rate": 0, + "description": account_head, + }, + ) + + def get_tax_row(self, account_head): + for row in self.taxes: + if row.account_head == account_head: + return row + def set_other_charges(self): self.set("taxes", []) self.set_taxes() diff --git a/erpnext/selling/doctype/quotation/test_quotation.py b/erpnext/selling/doctype/quotation/test_quotation.py index 41463eb2e5..b0a2b7cc44 100644 --- a/erpnext/selling/doctype/quotation/test_quotation.py +++ b/erpnext/selling/doctype/quotation/test_quotation.py @@ -597,6 +597,61 @@ class TestQuotation(FrappeTestCase): quotation.items[0].conversion_factor = 2.23 self.assertRaises(frappe.ValidationError, quotation.save) + def test_item_tax_template_for_quotation(self): + from erpnext.stock.doctype.item.test_item import make_item + + if not frappe.db.exists("Account", {"account_name": "_Test Vat", "company": "_Test Company"}): + frappe.get_doc( + { + "doctype": "Account", + "account_name": "_Test Vat", + "company": "_Test Company", + "account_type": "Tax", + "root_type": "Asset", + "is_group": 0, + "parent_account": "Tax Assets - _TC", + "tax_rate": 10, + } + ).insert() + + if not frappe.db.exists("Item Tax Template", "Vat Template - _TC"): + doc = frappe.get_doc( + { + "doctype": "Item Tax Template", + "name": "Vat Template", + "title": "Vat Template", + "company": "_Test Company", + "taxes": [ + { + "tax_type": "_Test Vat - _TC", + "tax_rate": 5, + } + ], + } + ).insert() + + item_doc = make_item("_Test Item Tax Template QTN", {"is_stock_item": 1}) + if not frappe.db.exists( + "Item Tax", {"parent": item_doc.name, "item_tax_template": "Vat Template - _TC"} + ): + item_doc.append("taxes", {"item_tax_template": "Vat Template - _TC"}) + item_doc.save() + + quotation = make_quotation( + item_code="_Test Item Tax Template QTN", qty=1, rate=100, do_not_submit=1 + ) + self.assertFalse(quotation.taxes) + + quotation.append_taxes_from_item_tax_template() + quotation.save() + self.assertTrue(quotation.taxes) + for row in quotation.taxes: + self.assertEqual(row.account_head, "_Test Vat - _TC") + self.assertAlmostEqual(row.base_tax_amount, quotation.total * 5 / 100) + + item_doc.taxes = [] + item_doc.save() + test_records = frappe.get_test_records("Quotation") From 53b844f173b43a61d706a16db709974da89c3fa5 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Thu, 25 Jan 2024 06:48:53 +0000 Subject: [PATCH 15/40] chore(release): Bumped to Version 15.10.6 ## [15.10.6](https://github.com/frappe/erpnext/compare/v15.10.5...v15.10.6) (2024-01-25) ### Bug Fixes * Item Tax template is not working for e-commerce ([83c1208](https://github.com/frappe/erpnext/commit/83c120849f4780d2bfd79a6a0a69ec09b1b40f04)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 9ac3ce7e61..9be8f11cc7 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "15.10.5" +__version__ = "15.10.6" def get_default_company(user=None): From 30bdba48016820a63ea4ee9c35c624d56367e483 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Sat, 27 Jan 2024 10:12:45 +0530 Subject: [PATCH 16/40] fix: incorrect amount in the material request item (backport #39567) (backport #39569) (#39587) fix: incorrect amount in the material request item (backport #39567) (#39569) fix: incorrect amount in the material request item (#39567) fix: incoorect amount in the material request (cherry picked from commit 2bdfdeeb9a5f2fd98cf67fc983a920790e56e1e1) Co-authored-by: rohitwaghchaure (cherry picked from commit e0c35d60b4de223cf75af536189db5bb253b6819) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- erpnext/stock/doctype/material_request/material_request.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/erpnext/stock/doctype/material_request/material_request.js b/erpnext/stock/doctype/material_request/material_request.js index d90b71a47a..03fe20b93a 100644 --- a/erpnext/stock/doctype/material_request/material_request.js +++ b/erpnext/stock/doctype/material_request/material_request.js @@ -514,6 +514,13 @@ erpnext.buying.MaterialRequestController = class MaterialRequestController exten schedule_date() { set_schedule_date(this.frm); } + + qty(doc, cdt, cdn) { + var row = frappe.get_doc(cdt, cdn); + row.amount = flt(row.qty) * flt(row.rate); + frappe.model.set_value(cdt, cdn, "amount", row.amount); + refresh_field("amount", row.name, row.parentfield); + } }; // for backward compatibility: combine new and previous states From 0e2f57ba8906ba3011d7c5f3ba117b15e203c5ba Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Sat, 27 Jan 2024 04:43:59 +0000 Subject: [PATCH 17/40] chore(release): Bumped to Version 15.10.7 ## [15.10.7](https://github.com/frappe/erpnext/compare/v15.10.6...v15.10.7) (2024-01-27) ### Bug Fixes * incorrect amount in the material request item (backport [#39567](https://github.com/frappe/erpnext/issues/39567)) (backport [#39569](https://github.com/frappe/erpnext/issues/39569)) ([#39587](https://github.com/frappe/erpnext/issues/39587)) ([30bdba4](https://github.com/frappe/erpnext/commit/30bdba48016820a63ea4ee9c35c624d56367e483)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 9be8f11cc7..94390e5b67 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "15.10.6" +__version__ = "15.10.7" def get_default_company(user=None): From ff166e8104ce8690a4926518468b3a7fdcade99f Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 29 Jan 2024 10:08:40 +0530 Subject: [PATCH 18/40] fix: not able to save subcontracting purchase receipt (old flow) (backport #39590) (backport #39592) (#39608) fix: not able to save subcontracting purchase receipt (old flow) (backport #39590) (#39592) fix: not able to save subcontracting purchase receipt (old flow) (#39590) (cherry picked from commit 67d828dab36d6f64fdb41e5f2cd203d508d2998c) Co-authored-by: rohitwaghchaure (cherry picked from commit 63eef680d039ca886bdfd65cf1f0af95129daf5b) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- .../controllers/subcontracting_controller.py | 4 +- erpnext/stock/utils.py | 47 +++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/erpnext/controllers/subcontracting_controller.py b/erpnext/controllers/subcontracting_controller.py index 9555902a74..65d087261f 100644 --- a/erpnext/controllers/subcontracting_controller.py +++ b/erpnext/controllers/subcontracting_controller.py @@ -881,7 +881,9 @@ class SubcontractingController(StockController): "posting_time": self.posting_time, "qty": -1 * item.consumed_qty, "voucher_detail_no": item.name, - "serial_and_batch_bundle": item.serial_and_batch_bundle, + "serial_and_batch_bundle": item.get("serial_and_batch_bundle"), + "serial_no": item.get("serial_no"), + "batch_no": item.get("batch_no"), } ) diff --git a/erpnext/stock/utils.py b/erpnext/stock/utils.py index 4b0e2845c4..017db5d550 100644 --- a/erpnext/stock/utils.py +++ b/erpnext/stock/utils.py @@ -289,6 +289,21 @@ def get_incoming_rate(args, raise_error_if_no_rate=True): in_rate = batch_obj.get_incoming_rate() + elif (args.get("serial_no") or "").strip() and not args.get("serial_and_batch_bundle"): + in_rate = get_avg_purchase_rate(args.get("serial_no")) + elif ( + args.get("batch_no") + and frappe.db.get_value("Batch", args.get("batch_no"), "use_batchwise_valuation", cache=True) + and not args.get("serial_and_batch_bundle") + ): + in_rate = get_batch_incoming_rate( + item_code=args.get("item_code"), + warehouse=args.get("warehouse"), + batch_no=args.get("batch_no"), + posting_date=args.get("posting_date"), + posting_time=args.get("posting_time"), + ) + else: valuation_method = get_valuation_method(args.get("item_code")) previous_sle = get_previous_sle(args) @@ -319,6 +334,38 @@ def get_incoming_rate(args, raise_error_if_no_rate=True): return flt(in_rate) +def get_batch_incoming_rate( + item_code, warehouse, batch_no, posting_date, posting_time, creation=None +): + + sle = frappe.qb.DocType("Stock Ledger Entry") + + timestamp_condition = CombineDatetime(sle.posting_date, sle.posting_time) < CombineDatetime( + posting_date, posting_time + ) + if creation: + timestamp_condition |= ( + CombineDatetime(sle.posting_date, sle.posting_time) + == CombineDatetime(posting_date, posting_time) + ) & (sle.creation < creation) + + batch_details = ( + frappe.qb.from_(sle) + .select(Sum(sle.stock_value_difference).as_("batch_value"), Sum(sle.actual_qty).as_("batch_qty")) + .where( + (sle.item_code == item_code) + & (sle.warehouse == warehouse) + & (sle.batch_no == batch_no) + & (sle.serial_and_batch_bundle.isnull()) + & (sle.is_cancelled == 0) + ) + .where(timestamp_condition) + ).run(as_dict=True) + + if batch_details and batch_details[0].batch_qty: + return batch_details[0].batch_value / batch_details[0].batch_qty + + def get_avg_purchase_rate(serial_nos): """get average value of serial numbers""" From a3d4f63ba1f5f13616bbbcef25f79321d4763d04 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Mon, 29 Jan 2024 04:39:51 +0000 Subject: [PATCH 19/40] chore(release): Bumped to Version 15.10.8 ## [15.10.8](https://github.com/frappe/erpnext/compare/v15.10.7...v15.10.8) (2024-01-29) ### Bug Fixes * not able to save subcontracting purchase receipt (old flow) (backport [#39590](https://github.com/frappe/erpnext/issues/39590)) (backport [#39592](https://github.com/frappe/erpnext/issues/39592)) ([#39608](https://github.com/frappe/erpnext/issues/39608)) ([ff166e8](https://github.com/frappe/erpnext/commit/ff166e8104ce8690a4926518468b3a7fdcade99f)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 94390e5b67..e1d595ff3d 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "15.10.7" +__version__ = "15.10.8" def get_default_company(user=None): From f84f82c7d78c8077ad1524c3cb2bf7fd52efe024 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Tue, 30 Jan 2024 14:14:58 +0000 Subject: [PATCH 20/40] chore(release): Bumped to Version 15.11.0 # [15.11.0](https://github.com/frappe/erpnext/compare/v15.10.8...v15.11.0) (2024-01-30) ### Bug Fixes * AttributeError in company transaction deletion ([222005c](https://github.com/frappe/erpnext/commit/222005ca4486f4cff3b533a8143b9c894998948b)) * **Batch:** reload doc after splitting ([a97b8fd](https://github.com/frappe/erpnext/commit/a97b8fd876273cb23e424dbb07a8aa0a21e89af0)) * check page obj before adding menu ([0aa73e3](https://github.com/frappe/erpnext/commit/0aa73e31cec38f976e96dc6307429a37e5ee7269)) * default enable closing stock balance (backport [#39551](https://github.com/frappe/erpnext/issues/39551)) ([#39554](https://github.com/frappe/erpnext/issues/39554)) ([4853ab1](https://github.com/frappe/erpnext/commit/4853ab1fec3b1c7ef562ae854b80e366e3d2f0e3)) * do not auto-populate item delivery date ([5cdc22a](https://github.com/frappe/erpnext/commit/5cdc22adf3b85e651e7ec2d9e889de0b3648f2a3)) * email list for auto reorder material request ([98c5653](https://github.com/frappe/erpnext/commit/98c56535d8670ae6271063ace60cefd35e365d07)) * enqueue JV submission when more than 100 accounts ([07bcc24](https://github.com/frappe/erpnext/commit/07bcc24e35b1f1ca5c9d03c0180e7975c6c266be)) * fetch correct quantity and amount for grouped asset ([3bdd1e9](https://github.com/frappe/erpnext/commit/3bdd1e9514e30183d5b17a64e8e32c06a33ce1fe)) * honour currency precision while fetching balance ([e0a3820](https://github.com/frappe/erpnext/commit/e0a38207f6ccf7c6faf5c43c343a9ed364d649ac)) * incorrect active serial nos (backport [#39389](https://github.com/frappe/erpnext/issues/39389)) ([#39589](https://github.com/frappe/erpnext/issues/39589)) ([7def475](https://github.com/frappe/erpnext/commit/7def475eb12bcbe4a546ceeee4982bb5229d0366)) * incorrect amount in the material request item (backport [#39567](https://github.com/frappe/erpnext/issues/39567)) ([#39569](https://github.com/frappe/erpnext/issues/39569)) ([e0c35d6](https://github.com/frappe/erpnext/commit/e0c35d60b4de223cf75af536189db5bb253b6819)) * Item Tax template is not working for e-commerce ([2905db1](https://github.com/frappe/erpnext/commit/2905db19e5f28aa3b5ad97d93451d6e0703bfb25)) * make SO item code reqd ([171586d](https://github.com/frappe/erpnext/commit/171586db9bacf4062e65dc34da5568205856eb94)) * not able to edit address through portal ([1f5dbeb](https://github.com/frappe/erpnext/commit/1f5dbebe680cd5fc6ad3e621db850fb6ca2ff798)) * not able to save BOM (duplicate key error) (backport [#39620](https://github.com/frappe/erpnext/issues/39620)) ([#39623](https://github.com/frappe/erpnext/issues/39623)) ([53c7055](https://github.com/frappe/erpnext/commit/53c705506bed570f77ad5c0293cd85668afd97b8)) * not able to save subcontracting purchase receipt (old flow) (backport [#39590](https://github.com/frappe/erpnext/issues/39590)) ([#39592](https://github.com/frappe/erpnext/issues/39592)) ([63eef68](https://github.com/frappe/erpnext/commit/63eef680d039ca886bdfd65cf1f0af95129daf5b)) * not able to submit subcontracting pr (old flow) (backport [#39622](https://github.com/frappe/erpnext/issues/39622)) ([#39625](https://github.com/frappe/erpnext/issues/39625)) ([960443d](https://github.com/frappe/erpnext/commit/960443d268ea530004a170f3616c936016ff3d95)) * Payment Terms Status for Sales Order report should show all payment terms from order not only this comming from template ([b2e0d24](https://github.com/frappe/erpnext/commit/b2e0d24954a5438ee9871bcbd0a21086008d301d)) * perf issue while submitting stock entry (backport [#39634](https://github.com/frappe/erpnext/issues/39634)) ([#39642](https://github.com/frappe/erpnext/issues/39642)) ([d785c6c](https://github.com/frappe/erpnext/commit/d785c6ce3e6835b0cd08b1100a1a4ae497225dfd)) * prevent extra transfer against inter transfer transaction (backport [#39213](https://github.com/frappe/erpnext/issues/39213)) ([#39596](https://github.com/frappe/erpnext/issues/39596)) ([6d4ca6a](https://github.com/frappe/erpnext/commit/6d4ca6a1ee2adffd58362161d89f484143f6b0c6)) * qtn tests using delivery date ([6b20a7e](https://github.com/frappe/erpnext/commit/6b20a7eed1170fa27e3526d3bc7910478f802d7f)) * return doc obj after submit ([da33079](https://github.com/frappe/erpnext/commit/da33079f128b265f5e487a33c0c26d16daa427a1)) * Serial No Ledger permission issue ([f9d1995](https://github.com/frappe/erpnext/commit/f9d199595461695a09298c586459f8a6fa06fcb5)) * skip liability account for internal transfer ([e2d85c5](https://github.com/frappe/erpnext/commit/e2d85c513cffca2bac54caeb98d74a8608496f34)) * type error on company doc ([a7d1368](https://github.com/frappe/erpnext/commit/a7d13686c7c0aaac33a81ced45e200be74c7c944)) ### Features * In words in payment entry ([5df2f5d](https://github.com/frappe/erpnext/commit/5df2f5d523013117de8412ee65ae05dfbeac12f7)) * New financial views - Growth and margin views for P&L and balance sheet ([#39588](https://github.com/frappe/erpnext/issues/39588)) ([a83f310](https://github.com/frappe/erpnext/commit/a83f3106f3ace0b5ec10c1e0209add4ea610432f)) * Partly billed status in Purchase Receipt ([#39543](https://github.com/frappe/erpnext/issues/39543)) ([e4230cf](https://github.com/frappe/erpnext/commit/e4230cf6d9e3b7767bd79d77b5f67b1ec5f5af1e)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index e1d595ff3d..d0fd6da270 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "15.10.8" +__version__ = "15.11.0" def get_default_company(user=None): From 0405a2b8170f10f9e11727b443fe75fdc7cc11a0 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 2 Feb 2024 20:53:03 +0530 Subject: [PATCH 21/40] fix: Percentage handling in queries (#39692) fix: Percentage handling in queries (#39692) fix: Percentage handling in queries (#39692) * fix: Percentage handling in queries * test: Account with percent sign * chore: add test records (cherry picked from commit 6d87cfeb8d87b6faed8a7238cd8cf97df2acd99d) Co-authored-by: Deepesh Garg (cherry picked from commit e76f59803cebd7ba19a2d0618dce959dfce263b2) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- erpnext/accounts/doctype/account/test_account.py | 14 ++++++++++++++ erpnext/accounts/utils.py | 10 +++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/erpnext/accounts/doctype/account/test_account.py b/erpnext/accounts/doctype/account/test_account.py index 30eebef7fb..a26eba1aba 100644 --- a/erpnext/accounts/doctype/account/test_account.py +++ b/erpnext/accounts/doctype/account/test_account.py @@ -6,6 +6,7 @@ import unittest import frappe from frappe.test_runner import make_test_records +from frappe.utils import nowdate from erpnext.accounts.doctype.account.account import ( InvalidAccountMergeError, @@ -324,6 +325,19 @@ class TestAccount(unittest.TestCase): acc.account_currency = "USD" self.assertRaises(frappe.ValidationError, acc.save) + def test_account_balance(self): + from erpnext.accounts.utils import get_balance_on + + if not frappe.db.exists("Account", "Test Percent Account %5 - _TC"): + acc = frappe.new_doc("Account") + acc.account_name = "Test Percent Account %5" + acc.parent_account = "Tax Assets - _TC" + acc.company = "_Test Company" + acc.insert() + + balance = get_balance_on(account="Test Percent Account %5 - _TC", date=nowdate()) + self.assertEqual(balance, 0) + def _make_test_records(verbose=None): from frappe.test_runner import make_test_objects diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index a61b09e1e8..d7b13bf7ed 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -237,7 +237,7 @@ def get_balance_on( ) else: - cond.append("""gle.cost_center = %s """ % (frappe.db.escape(cost_center, percent=False),)) + cond.append("""gle.cost_center = %s """ % (frappe.db.escape(cost_center),)) if account: if not (frappe.flags.ignore_account_permission or ignore_account_permission): @@ -258,7 +258,7 @@ def get_balance_on( if acc.account_currency == frappe.get_cached_value("Company", acc.company, "default_currency"): in_account_currency = False else: - cond.append("""gle.account = %s """ % (frappe.db.escape(account, percent=False),)) + cond.append("""gle.account = %s """ % (frappe.db.escape(account),)) if account_type: accounts = frappe.db.get_all( @@ -278,11 +278,11 @@ def get_balance_on( if party_type and party: cond.append( """gle.party_type = %s and gle.party = %s """ - % (frappe.db.escape(party_type), frappe.db.escape(party, percent=False)) + % (frappe.db.escape(party_type), frappe.db.escape(party)) ) if company: - cond.append("""gle.company = %s """ % (frappe.db.escape(company, percent=False))) + cond.append("""gle.company = %s """ % (frappe.db.escape(company))) if account or (party_type and party) or account_type: precision = get_currency_precision() @@ -348,7 +348,7 @@ def get_count_on(account, fieldname, date): % (acc.lft, acc.rgt) ) else: - cond.append("""gle.account = %s """ % (frappe.db.escape(account, percent=False),)) + cond.append("""gle.account = %s """ % (frappe.db.escape(account),)) entries = frappe.db.sql( """ From 317a74b58c7ae657b97a0a70f2692fb988016582 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Fri, 2 Feb 2024 15:24:10 +0000 Subject: [PATCH 22/40] chore(release): Bumped to Version 15.11.1 ## [15.11.1](https://github.com/frappe/erpnext/compare/v15.11.0...v15.11.1) (2024-02-02) ### Bug Fixes * Percentage handling in queries ([#39692](https://github.com/frappe/erpnext/issues/39692)) ([0405a2b](https://github.com/frappe/erpnext/commit/0405a2b8170f10f9e11727b443fe75fdc7cc11a0)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index d0fd6da270..a35217f7c3 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "15.11.0" +__version__ = "15.11.1" def get_default_company(user=None): From 2ba283d138d3e79154567451ebb2be79241a4913 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Tue, 6 Feb 2024 18:44:29 +0000 Subject: [PATCH 23/40] chore(release): Bumped to Version 15.12.0 # [15.12.0](https://github.com/frappe/erpnext/compare/v15.11.1...v15.12.0) (2024-02-06) ### Bug Fixes * Blanket Order Ordered Quantity (backport [#39725](https://github.com/frappe/erpnext/issues/39725)) ([#39739](https://github.com/frappe/erpnext/issues/39739)) ([b126720](https://github.com/frappe/erpnext/commit/b12672082673418c40cebc22b8f7224c0cbe2757)) * conditionally display show btn setting ([e931432](https://github.com/frappe/erpnext/commit/e9314325cc3e2e2a8665f36220d658856b8e802a)) * correctly calculate diff amount for included taxes ([#39655](https://github.com/frappe/erpnext/issues/39655)) ([7f4cd3c](https://github.com/frappe/erpnext/commit/7f4cd3cd156e5d9df196d9635eaf19569d9ca7c6)) * do not throw validation for cancelled sle ([02f56ee](https://github.com/frappe/erpnext/commit/02f56ee20ef32b5fef4e99b44c6d431042c60794)) * don't overwrite existing terms in transaction ([dcdd3e8](https://github.com/frappe/erpnext/commit/dcdd3e8cc452bd31c4707ea93bf176d585e5822f)) * Exchange rate on MR to PO creation for muticurrency POs ([#39646](https://github.com/frappe/erpnext/issues/39646)) ([29eb090](https://github.com/frappe/erpnext/commit/29eb09052867de15b5a95ba22c45c7e3037aebb9)) * fetch/change tax template on basis of base_net_rate instead of net_rate ([#39448](https://github.com/frappe/erpnext/issues/39448)) ([d7c7748](https://github.com/frappe/erpnext/commit/d7c7748c03b66880d92d3d0450cf437d9ec51fa4)) * incorrect landed cost voucher amount ([a40864d](https://github.com/frappe/erpnext/commit/a40864dedeb9f17061a04a57451086b24b56a9ab)) * out of range for valuation_rate column in SE (backport [#39687](https://github.com/frappe/erpnext/issues/39687)) ([#39691](https://github.com/frappe/erpnext/issues/39691)) ([41e4632](https://github.com/frappe/erpnext/commit/41e46326c04bc7939bc94fa57a82259ecaf5c7ee)) * Percentage handling in queries ([#39692](https://github.com/frappe/erpnext/issues/39692)) ([e76f598](https://github.com/frappe/erpnext/commit/e76f59803cebd7ba19a2d0618dce959dfce263b2)) * **portal:** show PO pay button if payments installed ([cea4ed6](https://github.com/frappe/erpnext/commit/cea4ed6f88af9ab226aa8bdcfdecf9b08cecc664)) * Pricing rule application/removal on qty change ([#39084](https://github.com/frappe/erpnext/issues/39084)) ([f310707](https://github.com/frappe/erpnext/commit/f31070741afd9a8d12aebda024a0537fa2dcbe8b)) * production plan date filters for orders (backport [#39702](https://github.com/frappe/erpnext/issues/39702)) ([#39720](https://github.com/frappe/erpnext/issues/39720)) ([3eac436](https://github.com/frappe/erpnext/commit/3eac436e7bbbe7df45db3d9555f93cea14e6252b)) * remove applied pricing rule on qty change (backport [#39688](https://github.com/frappe/erpnext/issues/39688)) ([#39737](https://github.com/frappe/erpnext/issues/39737)) ([f246684](https://github.com/frappe/erpnext/commit/f2466846946b83b5a03fa381cae56edd6573f73a)) * remove file from the disk after the completion of reposting ([b582e9c](https://github.com/frappe/erpnext/commit/b582e9c42c30765f83821726976ce18120534167)) * show warehouse title field in sales docs (backport [#39746](https://github.com/frappe/erpnext/issues/39746)) ([#39755](https://github.com/frappe/erpnext/issues/39755)) ([53992de](https://github.com/frappe/erpnext/commit/53992deb10a2a4fd4f7c16c6d03d2bf8bd8ddf36)) * update company in serial no doc (backport [#39733](https://github.com/frappe/erpnext/issues/39733)) ([#39747](https://github.com/frappe/erpnext/issues/39747)) ([00e86bf](https://github.com/frappe/erpnext/commit/00e86bf3186a01de99b596a840a8ee1bc526ee63)) * use old serial / batch fields to make serial batch bundle ([282c19e](https://github.com/frappe/erpnext/commit/282c19e7e1992d46336a15a2228e2bbc6279851c)) * **work order:** resolve type error during job card creation (backport [#39713](https://github.com/frappe/erpnext/issues/39713)) ([#39714](https://github.com/frappe/erpnext/issues/39714)) ([5fe40ac](https://github.com/frappe/erpnext/commit/5fe40ac0856d07903d1fbbe291c668435d07a77b)) ### Features * copy emails from lead to customer ([#38647](https://github.com/frappe/erpnext/issues/38647)) ([986273b](https://github.com/frappe/erpnext/commit/986273b6d31e803c81516e3f1a1fde5b2a283531)) * make material request for job card from workstation dashboard ([3bef12c](https://github.com/frappe/erpnext/commit/3bef12cb55fe381fc73a2e42f369651c8df82be3)) * Period-wise closing entries for TB ([#39712](https://github.com/frappe/erpnext/issues/39712)) ([1822325](https://github.com/frappe/erpnext/commit/1822325f340829b904676d621146a68c6f84b59c)) * reference for POS SI payments ([#39523](https://github.com/frappe/erpnext/issues/39523)) ([4ee8cf3](https://github.com/frappe/erpnext/commit/4ee8cf390793c0ec7d059fcdc3f5c30c3c47e6e9)) * visual plant floor ([75bd1e6](https://github.com/frappe/erpnext/commit/75bd1e6b65ceceb91db4b9494c77a528bbe9994c)) ### Performance Improvements * memory consumption for the stock balance report ([#39626](https://github.com/frappe/erpnext/issues/39626)) ([5e29aab](https://github.com/frappe/erpnext/commit/5e29aab83baece451af0636118da3112ef8f963b)) * Move dimension validation out of GL Entry doctype ([#39730](https://github.com/frappe/erpnext/issues/39730)) ([451c288](https://github.com/frappe/erpnext/commit/451c2880118cc0d09e38add2dc0b18fca5bb969a)) * timeout for auto material request through reorder level ([1b2831b](https://github.com/frappe/erpnext/commit/1b2831bdfe0b650c7c285f17907ba241f163dabb)) * timeout while submitting the purchase receipt entry ([55a8326](https://github.com/frappe/erpnext/commit/55a8326d065e5c439bfc69aa0e427158a60e328a)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index a35217f7c3..7de4ba1e90 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "15.11.1" +__version__ = "15.12.0" def get_default_company(user=None): From ae2a8db0d71ac938c5e30fedf617aa8737ba4112 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 7 Feb 2024 11:35:55 +0530 Subject: [PATCH 24/40] fix: set rate for PO created against BO (backport #39765) (backport #39767) (#39775) fix: set rate for PO created against BO (backport #39765) (#39767) * fix: set rate for PO created against BO (cherry picked from commit 0e5b4e5f07d15fe04855f1c836c5412d3644035a) # Conflicts: # erpnext/manufacturing/doctype/blanket_order/blanket_order.py * chore: `conflicts` --------- Co-authored-by: s-aga-r (cherry picked from commit 22138867f5906dc8808890d78ab7071bc59e92bc) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- erpnext/manufacturing/doctype/blanket_order/blanket_order.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/erpnext/manufacturing/doctype/blanket_order/blanket_order.py b/erpnext/manufacturing/doctype/blanket_order/blanket_order.py index b5ab63efd0..f8f336a6e8 100644 --- a/erpnext/manufacturing/doctype/blanket_order/blanket_order.py +++ b/erpnext/manufacturing/doctype/blanket_order/blanket_order.py @@ -90,6 +90,7 @@ def make_order(source_name): def update_item(source, target, source_parent): target_qty = source.get("qty") - source.get("ordered_qty") target.qty = target_qty if not flt(target_qty) < 0 else 0 + target.rate = source.get("rate") item = get_item_defaults(target.item_code, source_parent.company) if item: target.item_name = item.get("item_name") @@ -111,6 +112,10 @@ def make_order(source_name): }, }, ) + + if target_doc.doctype == "Purchase Order": + target_doc.set_missing_values() + return target_doc From 488e693ed8a70bd04528cbcb67219b9f2914408b Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 7 Feb 2024 06:07:15 +0000 Subject: [PATCH 25/40] chore(release): Bumped to Version 15.12.1 ## [15.12.1](https://github.com/frappe/erpnext/compare/v15.12.0...v15.12.1) (2024-02-07) ### Bug Fixes * set rate for PO created against BO (backport [#39765](https://github.com/frappe/erpnext/issues/39765)) (backport [#39767](https://github.com/frappe/erpnext/issues/39767)) ([#39775](https://github.com/frappe/erpnext/issues/39775)) ([ae2a8db](https://github.com/frappe/erpnext/commit/ae2a8db0d71ac938c5e30fedf617aa8737ba4112)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 7de4ba1e90..f3202ea37d 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "15.12.0" +__version__ = "15.12.1" def get_default_company(user=None): From 1f21607e4f689dc029c22f10a16eb663d0d4bcaa Mon Sep 17 00:00:00 2001 From: Gursheen Anand Date: Wed, 7 Feb 2024 18:27:08 +0530 Subject: [PATCH 26/40] fix: remove duplicates from tax category map (cherry picked from commit 3c6114ab72d21f3c27eb01baf65002d36b3e25fa) --- .../tax_withholding_details.py | 10 +-- .../test_tax_withholding_details.py | 89 +++++++++++++++---- 2 files changed, 74 insertions(+), 25 deletions(-) diff --git a/erpnext/accounts/report/tax_withholding_details/tax_withholding_details.py b/erpnext/accounts/report/tax_withholding_details/tax_withholding_details.py index 0c324c8bf1..d0f243a327 100644 --- a/erpnext/accounts/report/tax_withholding_details/tax_withholding_details.py +++ b/erpnext/accounts/report/tax_withholding_details/tax_withholding_details.py @@ -63,16 +63,14 @@ def get_result( tax_amount += entry.credit - entry.debit # infer tax withholding category from the account if it's the single account for this category tax_withholding_category = tds_accounts.get(entry.account) - rate = tax_rate_map.get(tax_withholding_category) # or else the consolidated value from the voucher document if not tax_withholding_category: - # or else from the party default tax_withholding_category = tax_category_map.get(name) - rate = tax_rate_map.get(tax_withholding_category) + # or else from the party default if not tax_withholding_category: tax_withholding_category = party_map.get(party, {}).get("tax_withholding_category") - rate = tax_rate_map.get(tax_withholding_category) + rate = tax_rate_map.get(tax_withholding_category) if net_total_map.get(name): if voucher_type == "Journal Entry": # back calcalute total amount from rate and tax_amount @@ -295,7 +293,7 @@ def get_tds_docs(filters): tds_accounts = {} for tds_acc in _tds_accounts: # if it turns out not to be the only tax withholding category, then don't include in the map - if tds_accounts.get(tds_acc["account"]): + if tds_acc["account"] in tds_accounts: tds_accounts[tds_acc["account"]] = None else: tds_accounts[tds_acc["account"]] = tds_acc["parent"] @@ -408,7 +406,7 @@ def get_doc_info(vouchers, doctype, tax_category_map, net_total_map=None): "paid_amount_after_tax", "base_paid_amount", ], - "Journal Entry": ["tax_withholding_category", "total_amount"], + "Journal Entry": ["total_amount"], } entries = frappe.get_all( diff --git a/erpnext/accounts/report/tax_withholding_details/test_tax_withholding_details.py b/erpnext/accounts/report/tax_withholding_details/test_tax_withholding_details.py index b3f67378a9..7515616b0b 100644 --- a/erpnext/accounts/report/tax_withholding_details/test_tax_withholding_details.py +++ b/erpnext/accounts/report/tax_withholding_details/test_tax_withholding_details.py @@ -5,7 +5,6 @@ import frappe from frappe.tests.utils import FrappeTestCase from frappe.utils import today -from erpnext.accounts.doctype.cost_center.test_cost_center import create_cost_center from erpnext.accounts.doctype.payment_entry.test_payment_entry import create_payment_entry from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice @@ -17,36 +16,63 @@ from erpnext.accounts.test.accounts_mixin import AccountsTestMixin from erpnext.accounts.utils import get_fiscal_year -class TestTdsPayableMonthly(AccountsTestMixin, FrappeTestCase): +class TestTaxWithholdingDetails(AccountsTestMixin, FrappeTestCase): def setUp(self): self.create_company() self.clear_old_entries() create_tax_accounts() - create_tcs_category() def test_tax_withholding_for_customers(self): + create_tax_category(cumulative_threshold=300) + frappe.db.set_value("Customer", "_Test Customer", "tax_withholding_category", "TCS") si = create_sales_invoice(rate=1000) pe = create_tcs_payment_entry() + jv = create_tcs_journal_entry() + filters = frappe._dict( company="_Test Company", party_type="Customer", from_date=today(), to_date=today() ) result = execute(filters)[1] expected_values = [ + # Check for JV totals using back calculation logic + [jv.name, "TCS", 0.075, -10000.0, -7.5, -10000.0], [pe.name, "TCS", 0.075, 2550, 0.53, 2550.53], [si.name, "TCS", 0.075, 1000, 0.52, 1000.52], ] self.check_expected_values(result, expected_values) + def test_single_account_for_multiple_categories(self): + create_tax_category("TDS - 1", rate=10, account="TDS - _TC") + inv_1 = make_purchase_invoice(rate=1000, do_not_submit=True) + inv_1.tax_withholding_category = "TDS - 1" + inv_1.submit() + + create_tax_category("TDS - 2", rate=20, account="TDS - _TC") + inv_2 = make_purchase_invoice(rate=1000, do_not_submit=True) + inv_2.tax_withholding_category = "TDS - 2" + inv_2.submit() + result = execute( + frappe._dict(company="_Test Company", party_type="Supplier", from_date=today(), to_date=today()) + )[1] + expected_values = [ + [inv_1.name, "TDS - 1", 10, 5000, 500, 5500], + [inv_2.name, "TDS - 2", 20, 5000, 1000, 6000], + ] + self.check_expected_values(result, expected_values) + def check_expected_values(self, result, expected_values): for i in range(len(result)): voucher = frappe._dict(result[i]) voucher_expected_values = expected_values[i] - self.assertEqual(voucher.ref_no, voucher_expected_values[0]) - self.assertEqual(voucher.section_code, voucher_expected_values[1]) - self.assertEqual(voucher.rate, voucher_expected_values[2]) - self.assertEqual(voucher.base_total, voucher_expected_values[3]) - self.assertAlmostEqual(voucher.tax_amount, voucher_expected_values[4]) - self.assertAlmostEqual(voucher.grand_total, voucher_expected_values[5]) + voucher_actual_values = ( + voucher.ref_no, + voucher.section_code, + voucher.rate, + voucher.base_total, + voucher.tax_amount, + voucher.grand_total, + ) + self.assertSequenceEqual(voucher_actual_values, voucher_expected_values) def tearDown(self): self.clear_old_entries() @@ -67,24 +93,20 @@ def create_tax_accounts(): ).insert(ignore_if_duplicate=True) -def create_tcs_category(): +def create_tax_category(category="TCS", rate=0.075, account="TCS - _TC", cumulative_threshold=0): fiscal_year = get_fiscal_year(today(), company="_Test Company") from_date = fiscal_year[1] to_date = fiscal_year[2] - tax_category = create_tax_withholding_category( - category_name="TCS", - rate=0.075, + create_tax_withholding_category( + category_name=category, + rate=rate, from_date=from_date, to_date=to_date, - account="TCS - _TC", - cumulative_threshold=300, + account=account, + cumulative_threshold=cumulative_threshold, ) - customer = frappe.get_doc("Customer", "_Test Customer") - customer.tax_withholding_category = "TCS" - customer.save() - def create_tcs_payment_entry(): payment_entry = create_payment_entry( @@ -109,3 +131,32 @@ def create_tcs_payment_entry(): ) payment_entry.submit() return payment_entry + + +def create_tcs_journal_entry(): + jv = frappe.new_doc("Journal Entry") + jv.posting_date = today() + jv.company = "_Test Company" + jv.set( + "accounts", + [ + { + "account": "Debtors - _TC", + "party_type": "Customer", + "party": "_Test Customer", + "credit_in_account_currency": 10000, + }, + { + "account": "Debtors - _TC", + "party_type": "Customer", + "party": "_Test Customer", + "debit_in_account_currency": 9992.5, + }, + { + "account": "TCS - _TC", + "debit_in_account_currency": 7.5, + }, + ], + ) + jv.insert() + return jv.submit() From bc9a63497a7b2df40564fdd3e3fd3017851a08a7 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 7 Feb 2024 14:22:43 +0000 Subject: [PATCH 27/40] chore(release): Bumped to Version 15.12.2 ## [15.12.2](https://github.com/frappe/erpnext/compare/v15.12.1...v15.12.2) (2024-02-07) ### Bug Fixes * remove duplicates from tax category map ([1f21607](https://github.com/frappe/erpnext/commit/1f21607e4f689dc029c22f10a16eb663d0d4bcaa)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index f3202ea37d..0f553ba9e9 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "15.12.1" +__version__ = "15.12.2" def get_default_company(user=None): From 592b3ff7b7e6b5aa0db8ca895d376081a9193af2 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 7 Feb 2024 16:32:23 +0530 Subject: [PATCH 28/40] refactor: cancel Cr/Dr JE's on Sales/Purchase return cancel (cherry picked from commit 0549535603cae6a7afbd3375c8dd62b517af3c6e) --- erpnext/controllers/accounts_controller.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 81a7a101e5..fa4333ab47 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -1472,6 +1472,24 @@ class AccountsController(TransactionBase): x.update({dim.fieldname: self.get(dim.fieldname)}) reconcile_against_document(lst, active_dimensions=active_dimensions) + def cancel_system_generated_credit_debit_notes(self): + # Cancel 'Credit/Debit' Note Journal Entries, if found. + if self.doctype in ["Sales Invoice", "Purchase Invoice"]: + voucher_type = "Credit Note" if self.doctype == "Sales Invoice" else "Debit Note" + journals = frappe.db.get_all( + "Journal Entry", + filters={ + "is_system_generated": 1, + "reference_type": self.doctype, + "reference_name": self.name, + "voucher_type": voucher_type, + "docstatus": 1, + }, + pluck="name", + ) + for x in journals: + frappe.get_doc("Journal Entry", x).cancel() + def on_cancel(self): from erpnext.accounts.doctype.bank_transaction.bank_transaction import ( remove_from_bank_transaction, @@ -1484,6 +1502,8 @@ class AccountsController(TransactionBase): remove_from_bank_transaction(self.doctype, self.name) if self.doctype in ["Sales Invoice", "Purchase Invoice", "Payment Entry", "Journal Entry"]: + self.cancel_system_generated_credit_debit_notes() + # Cancel Exchange Gain/Loss Journal before unlinking cancel_exchange_gain_loss_journal(self) From 490cbc53d8a4ae72339839fbf74315363cf9657a Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 7 Feb 2024 17:21:29 +0530 Subject: [PATCH 29/40] test: Invoice status on Cr/Dr note cancellation (cherry picked from commit 31a8c3bdc45f0e32a51e43260db8484e5f17aa75) --- .../test_payment_reconciliation.py | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py b/erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py index d7a73f0ce7..89240ac0d8 100644 --- a/erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py +++ b/erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py @@ -591,6 +591,66 @@ class TestPaymentReconciliation(FrappeTestCase): self.assertEqual(si.status, "Paid") self.assertEqual(si.outstanding_amount, 0) + def test_invoice_status_after_cr_note_cancellation(self): + # This test case is made after the 'always standalone Credit/Debit notes' feature is introduced + transaction_date = nowdate() + amount = 100 + + si = self.create_sales_invoice(qty=1, rate=amount, posting_date=transaction_date) + + cr_note = self.create_sales_invoice( + qty=-1, rate=amount, posting_date=transaction_date, do_not_save=True, do_not_submit=True + ) + cr_note.is_return = 1 + cr_note.return_against = si.name + cr_note = cr_note.save().submit() + + pr = self.create_payment_reconciliation() + + pr.get_unreconciled_entries() + invoices = [x.as_dict() for x in pr.get("invoices")] + payments = [x.as_dict() for x in pr.get("payments")] + pr.allocate_entries(frappe._dict({"invoices": invoices, "payments": payments})) + pr.reconcile() + + pr.get_unreconciled_entries() + self.assertEqual(pr.get("invoices"), []) + self.assertEqual(pr.get("payments"), []) + + journals = frappe.db.get_all( + "Journal Entry", + filters={ + "is_system_generated": 1, + "docstatus": 1, + "voucher_type": "Credit Note", + "reference_type": si.doctype, + "reference_name": si.name, + }, + pluck="name", + ) + self.assertEqual(len(journals), 1) + + # assert status outstanding + si.reload() + self.assertEqual(si.status, "Credit Note Issued") + self.assertEqual(si.outstanding_amount, 0) + + cr_note.reload() + cr_note.cancel() + # 'Credit Note' Journal should be auto cancelled + journals = frappe.db.get_all( + "Journal Entry", + filters={ + "is_system_generated": 1, + "docstatus": 1, + "voucher_type": "Credit Note", + "reference_type": si.doctype, + "reference_name": si.name, + }, + pluck="name", + ) + self.assertEqual(len(journals), 0) + def test_cr_note_partial_against_invoice(self): transaction_date = nowdate() amount = 100 From 5590b04c8945a26d105e1c4593f0c17cd4f14654 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 7 Feb 2024 17:33:55 +0530 Subject: [PATCH 30/40] refactor(test): assert Invoice status as well (cherry picked from commit 33efe0d12d85484e551dc9ebebf8840d427ecc67) --- .../payment_reconciliation/test_payment_reconciliation.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py b/erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py index 89240ac0d8..fb75a0f7ca 100644 --- a/erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py +++ b/erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py @@ -630,7 +630,7 @@ class TestPaymentReconciliation(FrappeTestCase): ) self.assertEqual(len(journals), 1) - # assert status outstanding + # assert status and outstanding si.reload() self.assertEqual(si.status, "Credit Note Issued") self.assertEqual(si.outstanding_amount, 0) @@ -650,6 +650,10 @@ class TestPaymentReconciliation(FrappeTestCase): pluck="name", ) self.assertEqual(len(journals), 0) + # assert status and outstanding + si.reload() + self.assertEqual(si.status, "Unpaid") + self.assertEqual(si.outstanding_amount, 100) def test_cr_note_partial_against_invoice(self): transaction_date = nowdate() From 7556457e3e58a0790b2b3b0d48efe8cec888638a Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 7 Feb 2024 19:59:33 +0530 Subject: [PATCH 31/40] refactor(test): Forex Credit Note cancellation against Invoice (cherry picked from commit 2f676ced5c712823c5737f40230ec8b1994cd2dd) --- .../controllers/tests/test_accounts_controller.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/erpnext/controllers/tests/test_accounts_controller.py b/erpnext/controllers/tests/test_accounts_controller.py index 3d6ebc02e6..fbdf22d5ae 100644 --- a/erpnext/controllers/tests/test_accounts_controller.py +++ b/erpnext/controllers/tests/test_accounts_controller.py @@ -1041,18 +1041,18 @@ class TestAccountsController(FrappeTestCase): cr_note.reload() cr_note.cancel() - # Exchange Gain/Loss Journal should've been created. + # with the introduction of 'cancel_system_generated_credit_debit_notes' in accounts controller + # JE(Credit Note) will be cancelled once the parent is cancelled exc_je_for_si = self.get_journals_for(si.doctype, si.name) exc_je_for_cr = self.get_journals_for(cr_note.doctype, cr_note.name) - self.assertNotEqual(exc_je_for_si, []) - self.assertEqual(len(exc_je_for_si), 1) + self.assertEqual(exc_je_for_si, []) + self.assertEqual(len(exc_je_for_si), 0) self.assertEqual(len(exc_je_for_cr), 0) - # The Credit Note JE is still active and is referencing the sales invoice - # So, outstanding stays the same + # No references, full outstanding si.reload() - self.assertEqual(si.outstanding_amount, 1) - self.assert_ledger_outstanding(si.doctype, si.name, 80.0, 1.0) + self.assertEqual(si.outstanding_amount, 2) + self.assert_ledger_outstanding(si.doctype, si.name, 160.0, 2.0) def test_40_cost_center_from_payment_entry(self): """ From beb4137dacbbb9365d12e142ec0a1da1d8e8762c Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Sun, 11 Feb 2024 17:48:47 +0530 Subject: [PATCH 32/40] feat: get RM costs from consumption entry in manufacture SE (backport #39822) (backport #39847) (#39849) feat: get RM costs from consumption entry in manufacture SE (backport #39822) (#39847) feat: get RM costs from consumption entry in manufacture SE (#39822) (cherry picked from commit 39067c761427e49c3c5aff5895faaee20de3f672) Co-authored-by: s-aga-r (cherry picked from commit 2d5f1868129812ea1ce2cc8fda012ee66d4e7106) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- .../manufacturing_settings.json | 10 +++- .../manufacturing_settings.py | 1 + .../doctype/work_order/test_work_order.py | 46 ++++++++++++++ .../stock/doctype/stock_entry/stock_entry.py | 60 +++++++++++++++++-- 4 files changed, 110 insertions(+), 7 deletions(-) diff --git a/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.json b/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.json index d3ad51f723..63e3fa3e9f 100644 --- a/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.json +++ b/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.json @@ -7,6 +7,7 @@ "field_order": [ "raw_materials_consumption_section", "material_consumption", + "get_rm_cost_from_consumption_entry", "column_break_3", "backflush_raw_materials_based_on", "capacity_planning", @@ -202,13 +203,20 @@ "fieldname": "set_op_cost_and_scrape_from_sub_assemblies", "fieldtype": "Check", "label": "Set Operating Cost / Scrape Items From Sub-assemblies" + }, + { + "default": "0", + "depends_on": "eval: doc.material_consumption", + "fieldname": "get_rm_cost_from_consumption_entry", + "fieldtype": "Check", + "label": "Get Raw Materials Cost from Consumption Entry" } ], "icon": "icon-wrench", "index_web_pages_for_search": 1, "issingle": 1, "links": [], - "modified": "2023-12-28 16:37:44.874096", + "modified": "2024-02-08 19:00:37.561244", "modified_by": "Administrator", "module": "Manufacturing", "name": "Manufacturing Settings", diff --git a/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.py b/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.py index 463ba9fe4b..9a501115b0 100644 --- a/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.py +++ b/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.py @@ -26,6 +26,7 @@ class ManufacturingSettings(Document): default_scrap_warehouse: DF.Link | None default_wip_warehouse: DF.Link | None disable_capacity_planning: DF.Check + get_rm_cost_from_consumption_entry: DF.Check job_card_excess_transfer: DF.Check make_serial_no_batch_from_work_order: DF.Check material_consumption: DF.Check diff --git a/erpnext/manufacturing/doctype/work_order/test_work_order.py b/erpnext/manufacturing/doctype/work_order/test_work_order.py index c8f3872622..010410732c 100644 --- a/erpnext/manufacturing/doctype/work_order/test_work_order.py +++ b/erpnext/manufacturing/doctype/work_order/test_work_order.py @@ -1775,6 +1775,52 @@ class TestWorkOrder(FrappeTestCase): "Manufacturing Settings", "set_op_cost_and_scrape_from_sub_assemblies", 0 ) + @change_settings( + "Manufacturing Settings", {"material_consumption": 1, "get_rm_cost_from_consumption_entry": 1} + ) + def test_get_rm_cost_from_consumption_entry(self): + from erpnext.stock.doctype.stock_entry.test_stock_entry import ( + make_stock_entry as make_stock_entry_test_record, + ) + + rm = make_item(properties={"is_stock_item": 1}).name + fg = make_item(properties={"is_stock_item": 1}).name + + make_stock_entry_test_record( + purpose="Material Receipt", + item_code=rm, + target="Stores - _TC", + qty=10, + basic_rate=100, + ) + make_stock_entry_test_record( + purpose="Material Receipt", + item_code=rm, + target="Stores - _TC", + qty=10, + basic_rate=200, + ) + + bom = make_bom(item=fg, raw_materials=[rm], rate=150).name + wo = make_wo_order_test_record( + production_item=fg, + bom_no=bom, + qty=10, + ) + + mte = frappe.get_doc(make_stock_entry(wo.name, "Material Transfer for Manufacture", 10)) + mte.items[0].s_warehouse = "Stores - _TC" + mte.insert().submit() + + mce = frappe.get_doc(make_stock_entry(wo.name, "Material Consumption for Manufacture", 10)) + mce.insert().submit() + + me = frappe.get_doc(make_stock_entry(wo.name, "Manufacture", 10)) + me.insert().submit() + + valuation_rate = sum([item.valuation_rate * item.transfer_qty for item in mce.items]) / 10 + self.assertEqual(me.items[0].valuation_rate, valuation_rate) + def prepare_boms_for_sub_assembly_test(): if not frappe.db.exists("BOM", {"item": "Test Final SF Item 1"}): diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index 4239191383..50a3bfaf15 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -899,14 +899,62 @@ class StockEntry(StockController): return flt(outgoing_items_cost / total_fg_qty) def get_basic_rate_for_manufactured_item(self, finished_item_qty, outgoing_items_cost=0) -> float: + settings = frappe.get_single("Manufacturing Settings") scrap_items_cost = sum([flt(d.basic_amount) for d in self.get("items") if d.is_scrap_item]) - # Get raw materials cost from BOM if multiple material consumption entries - if not outgoing_items_cost and frappe.db.get_single_value( - "Manufacturing Settings", "material_consumption", cache=True - ): - bom_items = self.get_bom_raw_materials(finished_item_qty) - outgoing_items_cost = sum([flt(row.qty) * flt(row.rate) for row in bom_items.values()]) + if settings.material_consumption: + if settings.get_rm_cost_from_consumption_entry and self.work_order: + + # Validate only if Material Consumption Entry exists for the Work Order. + if frappe.db.exists( + "Stock Entry", + { + "docstatus": 1, + "work_order": self.work_order, + "purpose": "Material Consumption for Manufacture", + }, + ): + for item in self.items: + if not item.is_finished_item and not item.is_scrap_item: + label = frappe.get_meta(settings.doctype).get_label("get_rm_cost_from_consumption_entry") + frappe.throw( + _( + "Row {0}: As {1} is enabled, raw materials cannot be added to {2} entry. Use {3} entry to consume raw materials." + ).format( + item.idx, + frappe.bold(label), + frappe.bold("Manufacture"), + frappe.bold("Material Consumption for Manufacture"), + ) + ) + + if frappe.db.exists( + "Stock Entry", {"docstatus": 1, "work_order": self.work_order, "purpose": "Manufacture"} + ): + frappe.throw( + _("Only one {0} entry can be created against the Work Order {1}").format( + frappe.bold("Manufacture"), frappe.bold(self.work_order) + ) + ) + + SE = frappe.qb.DocType("Stock Entry") + SE_ITEM = frappe.qb.DocType("Stock Entry Detail") + + outgoing_items_cost = ( + frappe.qb.from_(SE) + .left_join(SE_ITEM) + .on(SE.name == SE_ITEM.parent) + .select(Sum(SE_ITEM.valuation_rate * SE_ITEM.transfer_qty)) + .where( + (SE.docstatus == 1) + & (SE.work_order == self.work_order) + & (SE.purpose == "Material Consumption for Manufacture") + ) + ).run()[0][0] or 0 + + elif not outgoing_items_cost: + bom_items = self.get_bom_raw_materials(finished_item_qty) + outgoing_items_cost = sum([flt(row.qty) * flt(row.rate) for row in bom_items.values()]) return flt((outgoing_items_cost - scrap_items_cost) / finished_item_qty) From a29468f6fe7bfc1b244b3fd329f9e7a28c8e28bc Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Sun, 11 Feb 2024 12:20:07 +0000 Subject: [PATCH 33/40] chore(release): Bumped to Version 15.13.0 # [15.13.0](https://github.com/frappe/erpnext/compare/v15.12.2...v15.13.0) (2024-02-11) ### Features * get RM costs from consumption entry in manufacture SE (backport [#39822](https://github.com/frappe/erpnext/issues/39822)) (backport [#39847](https://github.com/frappe/erpnext/issues/39847)) ([#39849](https://github.com/frappe/erpnext/issues/39849)) ([beb4137](https://github.com/frappe/erpnext/commit/beb4137dacbbb9365d12e142ec0a1da1d8e8762c)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 0f553ba9e9..f6e585d4d0 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "15.12.2" +__version__ = "15.13.0" def get_default_company(user=None): From c78d085e24fc264c9a26c5d2831fc06320107b16 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 14 Feb 2024 12:06:08 +0000 Subject: [PATCH 34/40] chore(release): Bumped to Version 15.14.0 # [15.14.0](https://github.com/frappe/erpnext/compare/v15.13.0...v15.14.0) (2024-02-14) ### Bug Fixes * production plan issue with sales order (backport [#39901](https://github.com/frappe/erpnext/issues/39901)) ([#39904](https://github.com/frappe/erpnext/issues/39904)) ([88a7248](https://github.com/frappe/erpnext/commit/88a7248888f377ccceb4b8e04064d56f25b3a58d)) * add permissions to SRE (backport [#39780](https://github.com/frappe/erpnext/issues/39780)) ([#39786](https://github.com/frappe/erpnext/issues/39786)) ([ba05648](https://github.com/frappe/erpnext/commit/ba0564874143a287c97773385eef9cb694a8dff6)) * Brazilian COA for demo data creation ([#39839](https://github.com/frappe/erpnext/issues/39839)) ([4daee6d](https://github.com/frappe/erpnext/commit/4daee6d9c70e69a54222fda4f5b2f7052ca68b0b)) * calculate `stock_value_diff` ([5a66c85](https://github.com/frappe/erpnext/commit/5a66c8585c1fab062fe2f92068a4e59b1f2d2bc9)) * create SBB for `transfer_qty` in SE (backport [#39835](https://github.com/frappe/erpnext/issues/39835)) ([#39863](https://github.com/frappe/erpnext/issues/39863)) ([92e6017](https://github.com/frappe/erpnext/commit/92e6017a298bfb01679b5388f478a3055143a80e)) * do not consider rejected warehouses in pick list (backport [#39539](https://github.com/frappe/erpnext/issues/39539)) (backport [#39804](https://github.com/frappe/erpnext/issues/39804)) ([#39811](https://github.com/frappe/erpnext/issues/39811)) ([30dacce](https://github.com/frappe/erpnext/commit/30daccecc70839553d69845963f7d3f6c7c09957)) * incorrect planned qty in PP (backport [#39785](https://github.com/frappe/erpnext/issues/39785)) ([#39793](https://github.com/frappe/erpnext/issues/39793)) ([60e04ab](https://github.com/frappe/erpnext/commit/60e04ab6618196a79d53ffab9e4ea02917615076)) * landed cost voucher not submitting because of incorrect reference (backport [#39898](https://github.com/frappe/erpnext/issues/39898)) ([#39900](https://github.com/frappe/erpnext/issues/39900)) ([a548f12](https://github.com/frappe/erpnext/commit/a548f1294147675be76e448bde58c8bcb2fa5b9b)) * remove duplicates from tax category map ([3c6114a](https://github.com/frappe/erpnext/commit/3c6114ab72d21f3c27eb01baf65002d36b3e25fa)) * set rate for PO created against BO (backport [#39765](https://github.com/frappe/erpnext/issues/39765)) ([#39767](https://github.com/frappe/erpnext/issues/39767)) ([2213886](https://github.com/frappe/erpnext/commit/22138867f5906dc8808890d78ab7071bc59e92bc)) * stock entry for use serial batch fields (backport [#39843](https://github.com/frappe/erpnext/issues/39843)) ([#39844](https://github.com/frappe/erpnext/issues/39844)) ([43fce29](https://github.com/frappe/erpnext/commit/43fce29a044b377becda8f55b9056f7d4ee2de15)) * use correct field name in accounts controller (backport [#39884](https://github.com/frappe/erpnext/issues/39884)) ([#39897](https://github.com/frappe/erpnext/issues/39897)) ([f08b424](https://github.com/frappe/erpnext/commit/f08b424972b08e98f24cc0dc8d70a4cade3690cb)) * **ux:** set rate as price list rate on uom change in MR (backport [#39816](https://github.com/frappe/erpnext/issues/39816)) ([#39818](https://github.com/frappe/erpnext/issues/39818)) ([63b4d20](https://github.com/frappe/erpnext/commit/63b4d20bdfbfbc894a255187bd2c45ac95782165)) * validate duplicate SBB (backport [#39862](https://github.com/frappe/erpnext/issues/39862)) ([#39866](https://github.com/frappe/erpnext/issues/39866)) ([a2f1a96](https://github.com/frappe/erpnext/commit/a2f1a964f1d05f541bfd48dd24be419c3d5477db)) * warehouse issue in pick list (backport [#39826](https://github.com/frappe/erpnext/issues/39826)) ([#39827](https://github.com/frappe/erpnext/issues/39827)) ([b625b05](https://github.com/frappe/erpnext/commit/b625b05ddcd5cff7b51bc6e578c47d8eb76e662a)) ### Features * get RM costs from consumption entry in manufacture SE (backport [#39822](https://github.com/frappe/erpnext/issues/39822)) ([#39847](https://github.com/frappe/erpnext/issues/39847)) ([2d5f186](https://github.com/frappe/erpnext/commit/2d5f1868129812ea1ce2cc8fda012ee66d4e7106)) ### Performance Improvements * cached get_last_purchase_details to fix performance issue (backport [#39854](https://github.com/frappe/erpnext/issues/39854)) ([#39856](https://github.com/frappe/erpnext/issues/39856)) ([c643e70](https://github.com/frappe/erpnext/commit/c643e70e2f79fdf11e1d033fb7efd71408450288)) * production plan submission (backport [#39846](https://github.com/frappe/erpnext/issues/39846)) ([#39860](https://github.com/frappe/erpnext/issues/39860)) ([10f17df](https://github.com/frappe/erpnext/commit/10f17dfcc8b5a2d38b064af2698c2e96f0309fb4)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index f6e585d4d0..7b15096cf0 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "15.13.0" +__version__ = "15.14.0" def get_default_company(user=None): From 72ff56be1368e933554de36cbfa8fa740e95cf60 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Fri, 16 Feb 2024 15:41:30 +0530 Subject: [PATCH 35/40] fix: use serial batch fields not enabled for new stock entry (cherry picked from commit dc9115a5865c86721863cfbda55bb00ac00cb756) (cherry picked from commit 40d4e3261efd3eb8f98b05b2b7d35b08e1a50c18) --- erpnext/public/js/controllers/transaction.js | 2 +- .../stock/doctype/stock_entry/stock_entry.js | 34 +++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 0241afcf03..d08c36c1d0 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -234,7 +234,7 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe } set_fields_onload_for_line_item() { - if (this.frm.is_new && this.frm.doc?.items) { + if (this.frm.is_new() && this.frm.doc?.items) { this.frm.doc.items.forEach(item => { if (item.docstatus === 0 && frappe.meta.has_field(item.doctype, "use_serial_batch_fields") diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js index 8da3e8fdd0..6753a3a216 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry.js @@ -936,6 +936,7 @@ erpnext.stock.StockEntry = class StockEntry extends erpnext.stock.StockControlle this.toggle_related_fields(this.frm.doc); this.toggle_enable_bom(); this.show_stock_ledger(); + this.set_fields_onload_for_line_item(); erpnext.utils.view_serial_batch_nos(this.frm); if (this.frm.doc.docstatus===1 && erpnext.is_perpetual_inventory_enabled(this.frm.doc.company)) { this.show_general_ledger(); @@ -944,6 +945,35 @@ erpnext.stock.StockEntry = class StockEntry extends erpnext.stock.StockControlle erpnext.utils.add_item(this.frm); } + serial_no(doc, cdt, cdn) { + var item = frappe.get_doc(cdt, cdn); + + if (item?.serial_no) { + // Replace all occurences of comma with line feed + item.serial_no = item.serial_no.replace(/,/g, '\n'); + item.conversion_factor = item.conversion_factor || 1; + + let valid_serial_nos = []; + let serialnos = item.serial_no.split("\n"); + for (var i = 0; i < serialnos.length; i++) { + if (serialnos[i] != "") { + valid_serial_nos.push(serialnos[i]); + } + } + frappe.model.set_value(item.doctype, item.name, + "qty", valid_serial_nos.length / item.conversion_factor); + } + } + + set_fields_onload_for_line_item() { + if (this.frm.is_new() && this.frm.doc?.items + && cint(frappe.user_defaults?.use_serial_batch_fields) === 1) { + this.frm.doc.items.forEach(item => { + frappe.model.set_value(item.doctype, item.name, "use_serial_batch_fields", 1); + }) + } + } + scan_barcode() { frappe.flags.dialog_set = false; const barcode_scanner = new erpnext.utils.BarcodeScanner({frm:this.frm}); @@ -1074,6 +1104,10 @@ erpnext.stock.StockEntry = class StockEntry extends erpnext.stock.StockControlle if(!row.s_warehouse) row.s_warehouse = this.frm.doc.from_warehouse; if(!row.t_warehouse) row.t_warehouse = this.frm.doc.to_warehouse; + + if (cint(frappe.user_defaults?.use_serial_batch_fields)) { + frappe.model.set_value(row.doctype, row.name, "use_serial_batch_fields", 1); + } } from_warehouse(doc) { From 6d6a3a10fbf981550101da28f88e50c9d1428c51 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Fri, 16 Feb 2024 10:29:29 +0000 Subject: [PATCH 36/40] chore(release): Bumped to Version 15.14.1 ## [15.14.1](https://github.com/frappe/erpnext/compare/v15.14.0...v15.14.1) (2024-02-16) ### Bug Fixes * use serial batch fields not enabled for new stock entry ([72ff56b](https://github.com/frappe/erpnext/commit/72ff56be1368e933554de36cbfa8fa740e95cf60)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 7b15096cf0..94cb645281 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "15.14.0" +__version__ = "15.14.1" def get_default_company(user=None): From 3cd315973ce44ef2d3dd7622fb0567cff6dc50c4 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 16 Feb 2024 20:47:20 +0530 Subject: [PATCH 37/40] fix: batch filter not working in stock ledger report (backport #39934) (#39935) fix: batch filter not working in stock ledger report (cherry picked from commit a995e87567609ba4808e7bf2632b76004750aff0) Co-authored-by: Rohit Waghchaure (cherry picked from commit 15135952fcc259469b2c90cbc63aad20444a993b) --- .../stock/report/stock_ledger/stock_ledger.py | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/report/stock_ledger/stock_ledger.py b/erpnext/stock/report/stock_ledger/stock_ledger.py index e59f2fe644..86af9e9a06 100644 --- a/erpnext/stock/report/stock_ledger/stock_ledger.py +++ b/erpnext/stock/report/stock_ledger/stock_ledger.py @@ -320,15 +320,45 @@ def get_stock_ledger_entries(filters, items): if items: query = query.where(sle.item_code.isin(items)) - for field in ["voucher_no", "batch_no", "project", "company"]: + for field in ["voucher_no", "project", "company"]: if filters.get(field) and field not in inventory_dimension_fields: query = query.where(sle[field] == filters.get(field)) + if filters.get("batch_no"): + bundles = get_serial_and_batch_bundles(filters) + + if bundles: + query = query.where( + (sle.serial_and_batch_bundle.isin(bundles)) | (sle.batch_no == filters.batch_no) + ) + else: + query = query.where(sle.batch_no == filters.batch_no) + query = apply_warehouse_filter(query, sle, filters) return query.run(as_dict=True) +def get_serial_and_batch_bundles(filters): + SBB = frappe.qb.DocType("Serial and Batch Bundle") + SBE = frappe.qb.DocType("Serial and Batch Entry") + + query = ( + frappe.qb.from_(SBE) + .inner_join(SBB) + .on(SBE.parent == SBB.name) + .select(SBE.parent) + .where( + (SBB.docstatus == 1) + & (SBB.has_batch_no == 1) + & (SBB.voucher_no.notnull()) + & (SBE.batch_no == filters.batch_no) + ) + ) + + return query.run(pluck=SBE.parent) + + def get_inventory_dimension_fields(): return [dimension.fieldname for dimension in get_inventory_dimensions()] From fd76847cfaca701b9e174d14b3dc2fe861a699ad Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Fri, 16 Feb 2024 16:20:27 +0000 Subject: [PATCH 38/40] chore(release): Bumped to Version 15.14.2 ## [15.14.2](https://github.com/frappe/erpnext/compare/v15.14.1...v15.14.2) (2024-02-16) ### Bug Fixes * batch filter not working in stock ledger report (backport [#39934](https://github.com/frappe/erpnext/issues/39934)) ([#39935](https://github.com/frappe/erpnext/issues/39935)) ([3cd3159](https://github.com/frappe/erpnext/commit/3cd315973ce44ef2d3dd7622fb0567cff6dc50c4)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 94cb645281..877b6cdac2 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "15.14.1" +__version__ = "15.14.2" def get_default_company(user=None): From 2db79cdf3bbed5278680ed732c2212f5cbf07a38 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 19 Feb 2024 10:45:28 +0530 Subject: [PATCH 39/40] fix: do not empty serial batch fields (backport #39948) (#39956) fix: do not empty serial batch fields (#39948) (cherry picked from commit a4cbfabe0ee4c8fca3ac654e6b3fe3db8b551334) Co-authored-by: rohitwaghchaure (cherry picked from commit acd2e93f8cd4873f6e6f88b620f3308801e8f31a) --- erpnext/controllers/stock_controller.py | 6 +++--- erpnext/public/js/controllers/buying.js | 4 ++-- erpnext/public/js/utils/sales_common.js | 2 +- erpnext/stock/doctype/pick_list/pick_list.js | 2 +- .../stock/doctype/purchase_receipt/test_purchase_receipt.py | 2 +- erpnext/stock/doctype/stock_entry/stock_entry.js | 2 +- erpnext/stock/doctype/stock_entry/test_stock_entry.py | 4 ++-- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py index f920706ba6..0e039b9d1b 100644 --- a/erpnext/controllers/stock_controller.py +++ b/erpnext/controllers/stock_controller.py @@ -162,6 +162,9 @@ class StockController(AccountsController): from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos from erpnext.stock.serial_batch_bundle import SerialBatchCreation + if self.get("_action") == "update_after_submit": + return + # To handle test cases if frappe.flags.in_test and frappe.flags.use_serial_and_batch_fields: return @@ -219,7 +222,6 @@ class StockController(AccountsController): row.db_set( { "rejected_serial_and_batch_bundle": sn_doc.name, - "rejected_serial_no": "", } ) else: @@ -227,8 +229,6 @@ class StockController(AccountsController): row.db_set( { "serial_and_batch_bundle": sn_doc.name, - "serial_no": "", - "batch_no": "", } ) diff --git a/erpnext/public/js/controllers/buying.js b/erpnext/public/js/controllers/buying.js index 77ecf75e0c..b3d301d988 100644 --- a/erpnext/public/js/controllers/buying.js +++ b/erpnext/public/js/controllers/buying.js @@ -368,7 +368,7 @@ erpnext.buying = { let update_values = { "serial_and_batch_bundle": r.name, - "qty": qty + "qty": qty / flt(item.conversion_factor || 1, precision("conversion_factor", item)) } if (r.warehouse) { @@ -408,7 +408,7 @@ erpnext.buying = { let update_values = { "serial_and_batch_bundle": r.name, - "rejected_qty": qty + "rejected_qty": qty / flt(item.conversion_factor || 1, precision("conversion_factor", item)) } if (r.warehouse) { diff --git a/erpnext/public/js/utils/sales_common.js b/erpnext/public/js/utils/sales_common.js index b8ec77f8e5..4bb78433ae 100644 --- a/erpnext/public/js/utils/sales_common.js +++ b/erpnext/public/js/utils/sales_common.js @@ -339,7 +339,7 @@ erpnext.sales_common = { frappe.model.set_value(item.doctype, item.name, { "serial_and_batch_bundle": r.name, - "qty": qty + "qty": qty / flt(item.conversion_factor || 1, precision("conversion_factor", item)) }); } } diff --git a/erpnext/stock/doctype/pick_list/pick_list.js b/erpnext/stock/doctype/pick_list/pick_list.js index 3cc2956e96..056cd5cc99 100644 --- a/erpnext/stock/doctype/pick_list/pick_list.js +++ b/erpnext/stock/doctype/pick_list/pick_list.js @@ -330,7 +330,7 @@ frappe.ui.form.on('Pick List Item', { let qty = Math.abs(r.total_qty); frappe.model.set_value(item.doctype, item.name, { "serial_and_batch_bundle": r.name, - "qty": qty + "qty": qty / flt(item.conversion_factor || 1, precision("conversion_factor", item)) }); } } diff --git a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py index ff0300f9e9..2b18507a5f 100644 --- a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py @@ -2222,7 +2222,7 @@ class TestPurchaseReceipt(FrappeTestCase): ) self.assertEqual(pr.items[0].use_serial_batch_fields, 1) - self.assertFalse(pr.items[0].serial_no) + self.assertTrue(pr.items[0].serial_no) self.assertTrue(pr.items[0].serial_and_batch_bundle) sbb_doc = frappe.get_doc("Serial and Batch Bundle", pr.items[0].serial_and_batch_bundle) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js index 6753a3a216..8c762915d4 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry.js @@ -1178,7 +1178,7 @@ erpnext.stock.select_batch_and_serial_no = (frm, item) => { if (r) { frappe.model.set_value(item.doctype, item.name, { "serial_and_batch_bundle": r.name, - "qty": Math.abs(r.total_qty) + "qty": Math.abs(r.total_qty) / flt(item.conversion_factor || 1, precision("conversion_factor", item)) }); } } diff --git a/erpnext/stock/doctype/stock_entry/test_stock_entry.py b/erpnext/stock/doctype/stock_entry/test_stock_entry.py index 571bef50f3..ebc20e1f6c 100644 --- a/erpnext/stock/doctype/stock_entry/test_stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/test_stock_entry.py @@ -1766,7 +1766,7 @@ class TestStockEntry(FrappeTestCase): ) self.assertTrue(se.items[0].use_serial_batch_fields) - self.assertFalse(se.items[0].serial_no) + self.assertTrue(se.items[0].serial_no) self.assertTrue(se.items[0].serial_and_batch_bundle) for serial_no in serial_nos: @@ -1784,7 +1784,7 @@ class TestStockEntry(FrappeTestCase): se1.reload() self.assertTrue(se1.items[0].use_serial_batch_fields) - self.assertFalse(se1.items[0].serial_no) + self.assertTrue(se1.items[0].serial_no) self.assertTrue(se1.items[0].serial_and_batch_bundle) for serial_no in serial_nos: From 9c01a5f7edf91b8b70ffad1d8a408354e9e285dc Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Mon, 19 Feb 2024 05:33:59 +0000 Subject: [PATCH 40/40] chore(release): Bumped to Version 15.14.3 ## [15.14.3](https://github.com/frappe/erpnext/compare/v15.14.2...v15.14.3) (2024-02-19) ### Bug Fixes * do not empty serial batch fields (backport [#39948](https://github.com/frappe/erpnext/issues/39948)) ([#39956](https://github.com/frappe/erpnext/issues/39956)) ([2db79cd](https://github.com/frappe/erpnext/commit/2db79cdf3bbed5278680ed732c2212f5cbf07a38)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 877b6cdac2..0eb42d222e 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "15.14.2" +__version__ = "15.14.3" def get_default_company(user=None):