From 2561cf2072812ea5d6530e7b1981f78ea3c681d9 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Tue, 20 Jun 2023 16:06:29 +0000 Subject: [PATCH 01/20] chore(release): Bumped to Version 14.27.9 ## [14.27.9](https://github.com/frappe/erpnext/compare/v14.27.8...v14.27.9) (2023-06-20) ### Bug Fixes * `Process Loss Report` (backport [#35712](https://github.com/frappe/erpnext/issues/35712)) ([#35719](https://github.com/frappe/erpnext/issues/35719)) ([55a8be5](https://github.com/frappe/erpnext/commit/55a8be5cad3932dec839e4da131b4a86550536ee)) * add validation for QI in PR (backport [#35677](https://github.com/frappe/erpnext/issues/35677)) ([#35757](https://github.com/frappe/erpnext/issues/35757)) ([59ab13c](https://github.com/frappe/erpnext/commit/59ab13c34f29ec3ccf1f55fbaf9b8486b79e4419)) * Allocated amount validation for other party types ([#35741](https://github.com/frappe/erpnext/issues/35741)) ([5541d68](https://github.com/frappe/erpnext/commit/5541d68477d5d8c71ce19ff46343c285bb408455)) * cannot start / stop jobs ([53ec2a9](https://github.com/frappe/erpnext/commit/53ec2a9268ca41fd44f58859df02c1f0876ed757)) * conflicts ([697fcef](https://github.com/frappe/erpnext/commit/697fcef98bbbf5b2980cbfc817bceac34c99ff18)) * consider field precision while setting sle actual_qty ([#35717](https://github.com/frappe/erpnext/issues/35717)) ([3f62e85](https://github.com/frappe/erpnext/commit/3f62e854e58346b86bf510a60712ae1a364a3e9c)) * date and finance book fixes in fixed asset register (backport [#35751](https://github.com/frappe/erpnext/issues/35751)) ([#35799](https://github.com/frappe/erpnext/issues/35799)) ([8b57ecd](https://github.com/frappe/erpnext/commit/8b57ecd8efba65af59904586685a391fb803958e)) * don't add GL Entry for Acc. Depr. while scrapping non-depreciable assets (backport [#35714](https://github.com/frappe/erpnext/issues/35714)) ([#35715](https://github.com/frappe/erpnext/issues/35715)) ([77b0c5f](https://github.com/frappe/erpnext/commit/77b0c5f722b1976d333edd9c053c1d216c7604b0)) * Duplicate addresses are creating while using the E-commerce ([703e4f4](https://github.com/frappe/erpnext/commit/703e4f4f5da73fc56ef1ff805864f065c9db455f)) * fix get outstanding invoices btn and add get outstanding orders btn (backport [#35776](https://github.com/frappe/erpnext/issues/35776)) ([#35787](https://github.com/frappe/erpnext/issues/35787)) ([42e25d4](https://github.com/frappe/erpnext/commit/42e25d4cdf3e3ed1ac61427ceeaf009523d1c1ab)) * for zero bal accounts, dr/cr only on currency that has balance ([7da461b](https://github.com/frappe/erpnext/commit/7da461b8624b4b49da54e172f75527820af79056)) * incorrect gl entries for standalone debit note with update stock ([3355dc2](https://github.com/frappe/erpnext/commit/3355dc2a41137a0fd00a9a37c9c00b5691181faa)) * incorrect stock value for purchase returned with rejected qty (backport [#35747](https://github.com/frappe/erpnext/issues/35747)) ([#35752](https://github.com/frappe/erpnext/issues/35752)) ([c11d950](https://github.com/frappe/erpnext/commit/c11d950fc5ebc6aee4bec2915a8cf78df83d3dc4)) * keyerror while checking the stock balance report ([baf014f](https://github.com/frappe/erpnext/commit/baf014fc61ef643e10efa969ef36f436ddc26c74)) * loan interest accrual date ([#35695](https://github.com/frappe/erpnext/issues/35695)) ([070df97](https://github.com/frappe/erpnext/commit/070df97663f763660e3f4a1b3d251f14a35f65a6)) * **patch:** enable existing serial no in stock settings ([#35762](https://github.com/frappe/erpnext/issues/35762)) ([3c790c1](https://github.com/frappe/erpnext/commit/3c790c12f2f91ed5a6b1c95319af582aaa13008b)) * stock error for service item ([2bbea63](https://github.com/frappe/erpnext/commit/2bbea63de178d54e146bb29bc89fdf9d4e39a4b4)) * test case ([4af0a9b](https://github.com/frappe/erpnext/commit/4af0a9b192c309b4d8d76f3fcf3cd9875de3d97b)) * unsupported operand type(s) for //: 'float' and 'NoneType' for POS Barcode search ([#35710](https://github.com/frappe/erpnext/issues/35710)) ([58a6bbc](https://github.com/frappe/erpnext/commit/58a6bbcf6d95f59821484ff29b585c10529a0fe4)) * update `Stock Reconciliation` diff qty while reposting ([bdb5cc8](https://github.com/frappe/erpnext/commit/bdb5cc8ad46585cc78deace8e97785b93776c4fb)) * **ux:** set route options for new `Batch` ([b261242](https://github.com/frappe/erpnext/commit/b261242792e5cf88384fbe03890e4afb4b8e1736)) * validation of job card in stock entry ([ce2bf5f](https://github.com/frappe/erpnext/commit/ce2bf5fb1c55d3bb4b566e50b9b12f3d89676ccd)) * work order serial no issue ([50a8907](https://github.com/frappe/erpnext/commit/50a8907e8c05a913bf3b1778760795db85f9d675)) ### Performance Improvements * Duplicate queries for UOM (backport [#35744](https://github.com/frappe/erpnext/issues/35744)) ([#35745](https://github.com/frappe/erpnext/issues/35745)) ([632b67c](https://github.com/frappe/erpnext/commit/632b67cbc84fc4f478fc4a4e4b363134dcc7b500)) * duplicate queries while checking prevdoc (backport [#35746](https://github.com/frappe/erpnext/issues/35746)) ([#35749](https://github.com/frappe/erpnext/issues/35749)) ([a0fc8e2](https://github.com/frappe/erpnext/commit/a0fc8e252c6f011a5376fa74d8a35203f3dc5cc0)) * Ignore cancelled pick lists while fetching picked items (backport [#35737](https://github.com/frappe/erpnext/issues/35737)) ([#35740](https://github.com/frappe/erpnext/issues/35740)) ([01ac54d](https://github.com/frappe/erpnext/commit/01ac54d65da057257734dd0ab399e8ffb5659c35)) * index `purpose` in `Stock Entry` (backport [#35782](https://github.com/frappe/erpnext/issues/35782)) ([#35783](https://github.com/frappe/erpnext/issues/35783)) ([3bac2a8](https://github.com/frappe/erpnext/commit/3bac2a88bd0022dc595621d08993a124b8080f20)) * Index pick list field in stock entry and DN (backport [#35738](https://github.com/frappe/erpnext/issues/35738)) ([#35742](https://github.com/frappe/erpnext/issues/35742)) ([b875de6](https://github.com/frappe/erpnext/commit/b875de6fb7998bbd7f089343b7da4dd358ac0ced)) * Index sales_order_item in Pick list item (backport [#35735](https://github.com/frappe/erpnext/issues/35735)) ([#35736](https://github.com/frappe/erpnext/issues/35736)) ([0e57f4d](https://github.com/frappe/erpnext/commit/0e57f4dd3ce44504a059be1a4d5f8f869ffe34b9)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index a36cdb55093..c058aa8ce35 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.27.8" +__version__ = "14.27.9" def get_default_company(user=None): From 3194e3a020ae2f4746d88c606dddb16c06f4af33 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 21 Jun 2023 14:19:02 +0530 Subject: [PATCH 02/20] fix: no permission for accounts settings on payment reconciliation (cherry picked from commit ad758b8d8511853934b7cfcfde42eddeff9a333c) --- .../payment_reconciliation.js | 40 ++++++++++--------- .../payment_reconciliation.py | 4 ++ 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.js b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.js index 08d38dde474..07f35c9fe11 100644 --- a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.js +++ b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.js @@ -85,25 +85,29 @@ erpnext.accounts.PaymentReconciliationController = class PaymentReconciliationCo // check for any running reconciliation jobs if (this.frm.doc.receivable_payable_account) { - frappe.db.get_single_value("Accounts Settings", "auto_reconcile_payments").then((enabled) => { - if(enabled) { - this.frm.call({ - 'method': "erpnext.accounts.doctype.process_payment_reconciliation.process_payment_reconciliation.is_any_doc_running", - "args": { - for_filter: { - company: this.frm.doc.company, - party_type: this.frm.doc.party_type, - party: this.frm.doc.party, - receivable_payable_account: this.frm.doc.receivable_payable_account + this.frm.call({ + doc: this.frm.doc, + method: 'is_auto_process_enabled', + callback: (r) => { + if (r.message) { + this.frm.call({ + 'method': "erpnext.accounts.doctype.process_payment_reconciliation.process_payment_reconciliation.is_any_doc_running", + "args": { + for_filter: { + company: this.frm.doc.company, + party_type: this.frm.doc.party_type, + party: this.frm.doc.party, + receivable_payable_account: this.frm.doc.receivable_payable_account + } } - } - }).then(r => { - if (r.message) { - let doc_link = frappe.utils.get_form_link("Process Payment Reconciliation", r.message, true); - let msg = __("Payment Reconciliation Job: {0} is running for this party. Can't reconcile now.", [doc_link]); - this.frm.dashboard.add_comment(msg, "yellow"); - } - }); + }).then(r => { + if (r.message) { + let doc_link = frappe.utils.get_form_link("Process Payment Reconciliation", r.message, true); + let msg = __("Payment Reconciliation Job: {0} is running for this party. Can't reconcile now.", [doc_link]); + this.frm.dashboard.add_comment(msg, "yellow"); + } + }); + } } }); } diff --git a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py index 2c8faecf4b1..2e4e3b0e078 100644 --- a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py +++ b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py @@ -252,6 +252,10 @@ class PaymentReconciliation(Document): return difference_amount + @frappe.whitelist() + def is_auto_process_enabled(self): + return frappe.db.get_single_value("Accounts Settings", "auto_reconcile_payments") + @frappe.whitelist() def calculate_difference_on_allocation_change(self, payment_entry, invoice, allocated_amount): invoice_exchange_map = self.get_invoice_exchange_map(invoice, payment_entry) From 4be554d8b4935177f3117b4fd367e71b54a1efa8 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 21 Jun 2023 21:52:44 +0530 Subject: [PATCH 03/20] fix: incorrect cost center error in bank reconciliation (cherry picked from commit 41b9e928680a5dca42e10c383d0b9301482540fb) --- .../bank_reconciliation_tool/bank_reconciliation_tool.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.py b/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.py index c4a23a640c3..0eef3e9a67b 100644 --- a/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.py +++ b/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.py @@ -10,6 +10,7 @@ from frappe.model.document import Document from frappe.query_builder.custom import ConstantColumn from frappe.utils import cint, flt +from erpnext import get_default_cost_center from erpnext.accounts.doctype.bank_transaction.bank_transaction import get_total_allocated_amount from erpnext.accounts.report.bank_reconciliation_statement.bank_reconciliation_statement import ( get_amounts_not_reflected_in_system, @@ -140,6 +141,9 @@ def create_journal_entry_bts( second_account ) ) + + company = frappe.get_value("Account", company_account, "company") + accounts = [] # Multi Currency? accounts.append( @@ -149,6 +153,7 @@ def create_journal_entry_bts( "debit_in_account_currency": bank_transaction.withdrawal, "party_type": party_type, "party": party, + "cost_center": get_default_cost_center(company), } ) @@ -158,11 +163,10 @@ def create_journal_entry_bts( "bank_account": bank_transaction.bank_account, "credit_in_account_currency": bank_transaction.withdrawal, "debit_in_account_currency": bank_transaction.deposit, + "cost_center": get_default_cost_center(company), } ) - company = frappe.get_value("Account", company_account, "company") - journal_entry_dict = { "voucher_type": entry_type, "company": company, From 71207a7daee5dba393759c2462cec4f0bf736187 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Thu, 22 Jun 2023 06:26:14 +0000 Subject: [PATCH 04/20] chore(release): Bumped to Version 14.27.10 ## [14.27.10](https://github.com/frappe/erpnext/compare/v14.27.9...v14.27.10) (2023-06-22) ### Bug Fixes * incorrect cost center error in bank reconciliation ([4be554d](https://github.com/frappe/erpnext/commit/4be554d8b4935177f3117b4fd367e71b54a1efa8)) * no permission for accounts settings on payment reconciliation ([3194e3a](https://github.com/frappe/erpnext/commit/3194e3a020ae2f4746d88c606dddb16c06f4af33)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index c058aa8ce35..919462c24a8 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.27.9" +__version__ = "14.27.10" def get_default_company(user=None): From f45e8b9c169d198dcf25d349cddcd4f1791898ea Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 22 Jun 2023 12:40:02 +0530 Subject: [PATCH 05/20] refactor: increase precision for current exc rate in ERR (cherry picked from commit b4db25dd188134dba30e22977c0fa4665ba749be) --- .../exchange_rate_revaluation_account.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/exchange_rate_revaluation_account/exchange_rate_revaluation_account.json b/erpnext/accounts/doctype/exchange_rate_revaluation_account/exchange_rate_revaluation_account.json index 0a7d0579b15..fd2d931315c 100644 --- a/erpnext/accounts/doctype/exchange_rate_revaluation_account/exchange_rate_revaluation_account.json +++ b/erpnext/accounts/doctype/exchange_rate_revaluation_account/exchange_rate_revaluation_account.json @@ -73,6 +73,7 @@ "fieldname": "current_exchange_rate", "fieldtype": "Float", "label": "Current Exchange Rate", + "precision": "9", "read_only": 1 }, { @@ -148,7 +149,7 @@ ], "istable": 1, "links": [], - "modified": "2023-06-20 07:21:40.743460", + "modified": "2023-06-22 12:39:56.446722", "modified_by": "Administrator", "module": "Accounts", "name": "Exchange Rate Revaluation Account", From 1d5415f39dad05c920e72a2f0c0731f8f02d1a45 Mon Sep 17 00:00:00 2001 From: Anand Baburajan Date: Thu, 22 Jun 2023 22:22:18 +0530 Subject: [PATCH 06/20] chore: asset scrap and restore fixes [v14] (#35851) chore: better err msg on cancelling JE for asset scrap and allow restoring non-depr assets (cherry picked from commit 69780da0996d00a6e8fc81b2fce860e47f971b30) --- .../doctype/journal_entry/journal_entry.py | 15 +++++++++++---- erpnext/assets/doctype/asset/depreciation.py | 3 +++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index b275cada953..0411fd1104e 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -326,12 +326,10 @@ class JournalEntry(AccountsController): d.db_update() def unlink_asset_reference(self): - if self.voucher_type != "Depreciation Entry": - return - for d in self.get("accounts"): if ( - d.reference_type == "Asset" + self.voucher_type == "Depreciation Entry" + and d.reference_type == "Asset" and d.reference_name and d.account_type == "Depreciation" and d.debit @@ -358,6 +356,15 @@ class JournalEntry(AccountsController): else: asset.db_set("value_after_depreciation", asset.value_after_depreciation + d.debit) asset.set_status() + elif self.voucher_type == "Journal Entry" and d.reference_type == "Asset" and d.reference_name: + journal_entry_for_scrap = frappe.db.get_value( + "Asset", d.reference_name, "journal_entry_for_scrap" + ) + + if journal_entry_for_scrap == self.name: + frappe.throw( + _("Journal Entry for Asset scrapping cannot be cancelled. Please restore the Asset.") + ) def unlink_inter_company_jv(self): if ( diff --git a/erpnext/assets/doctype/asset/depreciation.py b/erpnext/assets/doctype/asset/depreciation.py index 543c75a195f..cc428e35cb9 100644 --- a/erpnext/assets/doctype/asset/depreciation.py +++ b/erpnext/assets/doctype/asset/depreciation.py @@ -343,6 +343,9 @@ def modify_depreciation_schedule_for_asset_repairs(asset): def reverse_depreciation_entry_made_after_disposal(asset, date): + if not asset.calculate_depreciation: + return + row = -1 finance_book = asset.get("schedules")[0].get("finance_book") for schedule in asset.get("schedules"): From 2240aeb307fd10b197e27f0c309fc87c3c4689fb Mon Sep 17 00:00:00 2001 From: Anand Baburajan Date: Fri, 23 Jun 2023 08:21:32 +0530 Subject: [PATCH 07/20] fix: show non-depreciable assets in fixed asset register (#35858) fix: show non-depr assets in fixed asset register (cherry picked from commit 42d09448eed316268d9a5a2c9e25791bc48fa326) --- .../report/fixed_asset_register/fixed_asset_register.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/erpnext/assets/report/fixed_asset_register/fixed_asset_register.py b/erpnext/assets/report/fixed_asset_register/fixed_asset_register.py index f810819b4fc..6911f94bbbb 100644 --- a/erpnext/assets/report/fixed_asset_register/fixed_asset_register.py +++ b/erpnext/assets/report/fixed_asset_register/fixed_asset_register.py @@ -115,7 +115,11 @@ def get_data(filters): depreciation_amount_map = get_asset_depreciation_amount_map(filters, finance_book) for asset in assets_record: - if assets_linked_to_fb and asset.asset_id not in assets_linked_to_fb: + if ( + assets_linked_to_fb + and asset.calculate_depreciation + and asset.asset_id not in assets_linked_to_fb + ): continue asset_value = get_asset_value_after_depreciation( From d9008779de78252f481585958ec88dda674430cf Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Fri, 23 Jun 2023 02:55:10 +0000 Subject: [PATCH 08/20] chore(release): Bumped to Version 14.27.12 ## [14.27.12](https://github.com/frappe/erpnext/compare/v14.27.11...v14.27.12) (2023-06-23) ### Bug Fixes * show non-depreciable assets in fixed asset register ([#35858](https://github.com/frappe/erpnext/issues/35858)) ([2240aeb](https://github.com/frappe/erpnext/commit/2240aeb307fd10b197e27f0c309fc87c3c4689fb)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 919462c24a8..254b136d04f 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.27.10" +__version__ = "14.27.12" def get_default_company(user=None): From 189954eaf19f45758f1b39146c5bdc5dbd9eee05 Mon Sep 17 00:00:00 2001 From: Anand Baburajan Date: Wed, 28 Jun 2023 09:49:30 +0530 Subject: [PATCH 09/20] perf: improve item wise register reports (#35908) (cherry picked from commit 33ee01174bb909ee46bb3d714d6f94fa0aefe48f) --- .../item_wise_purchase_register.py | 31 ++++++++++++------- .../item_wise_sales_register.py | 30 ++++++++++++------ 2 files changed, 39 insertions(+), 22 deletions(-) diff --git a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py index d34c21348c8..120384ee204 100644 --- a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py +++ b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py @@ -15,7 +15,6 @@ from erpnext.accounts.report.item_wise_sales_register.item_wise_sales_register i get_group_by_conditions, get_tax_accounts, ) -from erpnext.selling.report.item_wise_sales_history.item_wise_sales_history import get_item_details def execute(filters=None): @@ -40,6 +39,16 @@ def _execute(filters=None, additional_table_columns=None, additional_query_colum tax_doctype="Purchase Taxes and Charges", ) + scrubbed_tax_fields = {} + + for tax in tax_columns: + scrubbed_tax_fields.update( + { + tax + " Rate": frappe.scrub(tax + " Rate"), + tax + " Amount": frappe.scrub(tax + " Amount"), + } + ) + po_pr_map = get_purchase_receipts_against_purchase_order(item_list) data = [] @@ -50,11 +59,7 @@ def _execute(filters=None, additional_table_columns=None, additional_query_colum if filters.get("group_by"): grand_total = get_grand_total(filters, "Purchase Invoice") - item_details = get_item_details() - for d in item_list: - item_record = item_details.get(d.item_code) - purchase_receipt = None if d.purchase_receipt: purchase_receipt = d.purchase_receipt @@ -67,8 +72,8 @@ def _execute(filters=None, additional_table_columns=None, additional_query_colum row = { "item_code": d.item_code, - "item_name": item_record.item_name if item_record else d.item_name, - "item_group": item_record.item_group if item_record else d.item_group, + "item_name": d.pi_item_name if d.pi_item_name else d.i_item_name, + "item_group": d.pi_item_group if d.pi_item_group else d.i_item_group, "description": d.description, "invoice": d.parent, "posting_date": d.posting_date, @@ -101,8 +106,8 @@ def _execute(filters=None, additional_table_columns=None, additional_query_colum item_tax = itemised_tax.get(d.name, {}).get(tax, {}) row.update( { - frappe.scrub(tax + " Rate"): item_tax.get("tax_rate", 0), - frappe.scrub(tax + " Amount"): item_tax.get("tax_amount", 0), + scrubbed_tax_fields[tax + " Rate"]: item_tax.get("tax_rate", 0), + scrubbed_tax_fields[tax + " Amount"]: item_tax.get("tax_amount", 0), } ) total_tax += flt(item_tax.get("tax_amount")) @@ -325,15 +330,17 @@ def get_items(filters, additional_query_columns): `tabPurchase Invoice`.supplier, `tabPurchase Invoice`.remarks, `tabPurchase Invoice`.base_net_total, `tabPurchase Invoice`.unrealized_profit_loss_account, `tabPurchase Invoice Item`.`item_code`, `tabPurchase Invoice Item`.description, - `tabPurchase Invoice Item`.`item_name`, `tabPurchase Invoice Item`.`item_group`, + `tabPurchase Invoice Item`.`item_name` as pi_item_name, `tabPurchase Invoice Item`.`item_group` as pi_item_group, + `tabItem`.`item_name` as i_item_name, `tabItem`.`item_group` as i_item_group, `tabPurchase Invoice Item`.`project`, `tabPurchase Invoice Item`.`purchase_order`, `tabPurchase Invoice Item`.`purchase_receipt`, `tabPurchase Invoice Item`.`po_detail`, `tabPurchase Invoice Item`.`expense_account`, `tabPurchase Invoice Item`.`stock_qty`, `tabPurchase Invoice Item`.`stock_uom`, `tabPurchase Invoice Item`.`base_net_amount`, `tabPurchase Invoice`.`supplier_name`, `tabPurchase Invoice`.`mode_of_payment` {0} - from `tabPurchase Invoice`, `tabPurchase Invoice Item` + from `tabPurchase Invoice`, `tabPurchase Invoice Item`, `tabItem` where `tabPurchase Invoice`.name = `tabPurchase Invoice Item`.`parent` and - `tabPurchase Invoice`.docstatus = 1 %s + `tabItem`.name = `tabPurchase Invoice Item`.`item_code` and + `tabPurchase Invoice`.docstatus = 1 %s """.format( additional_query_columns ) diff --git a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py index 0ebe13f4f32..bd7d02e0430 100644 --- a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py +++ b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py @@ -11,7 +11,6 @@ from frappe.utils.xlsxutils import handle_html from erpnext.accounts.report.sales_register.sales_register import get_mode_of_payments from erpnext.selling.report.item_wise_sales_history.item_wise_sales_history import ( get_customer_details, - get_item_details, ) @@ -35,6 +34,16 @@ def _execute( if item_list: itemised_tax, tax_columns = get_tax_accounts(item_list, columns, company_currency) + scrubbed_tax_fields = {} + + for tax in tax_columns: + scrubbed_tax_fields.update( + { + tax + " Rate": frappe.scrub(tax + " Rate"), + tax + " Amount": frappe.scrub(tax + " Amount"), + } + ) + mode_of_payments = get_mode_of_payments(set(d.parent for d in item_list)) so_dn_map = get_delivery_notes_against_sales_order(item_list) @@ -47,11 +56,9 @@ def _execute( grand_total = get_grand_total(filters, "Sales Invoice") customer_details = get_customer_details() - item_details = get_item_details() for d in item_list: customer_record = customer_details.get(d.customer) - item_record = item_details.get(d.item_code) delivery_note = None if d.delivery_note: @@ -64,8 +71,8 @@ def _execute( row = { "item_code": d.item_code, - "item_name": item_record.item_name if item_record else d.item_name, - "item_group": item_record.item_group if item_record else d.item_group, + "item_name": d.si_item_name if d.si_item_name else d.i_item_name, + "item_group": d.si_item_group if d.si_item_group else d.i_item_group, "description": d.description, "invoice": d.parent, "posting_date": d.posting_date, @@ -107,8 +114,8 @@ def _execute( item_tax = itemised_tax.get(d.name, {}).get(tax, {}) row.update( { - frappe.scrub(tax + " Rate"): item_tax.get("tax_rate", 0), - frappe.scrub(tax + " Amount"): item_tax.get("tax_amount", 0), + scrubbed_tax_fields[tax + " Rate"]: item_tax.get("tax_rate", 0), + scrubbed_tax_fields[tax + " Amount"]: item_tax.get("tax_amount", 0), } ) if item_tax.get("is_other_charges"): @@ -404,15 +411,18 @@ def get_items(filters, additional_query_columns, additional_conditions=None): `tabSales Invoice Item`.project, `tabSales Invoice Item`.item_code, `tabSales Invoice Item`.description, `tabSales Invoice Item`.`item_name`, `tabSales Invoice Item`.`item_group`, + `tabSales Invoice Item`.`item_name` as si_item_name, `tabSales Invoice Item`.`item_group` as si_item_group, + `tabItem`.`item_name` as i_item_name, `tabItem`.`item_group` as i_item_group, `tabSales Invoice Item`.sales_order, `tabSales Invoice Item`.delivery_note, `tabSales Invoice Item`.income_account, `tabSales Invoice Item`.cost_center, `tabSales Invoice Item`.stock_qty, `tabSales Invoice Item`.stock_uom, `tabSales Invoice Item`.base_net_rate, `tabSales Invoice Item`.base_net_amount, `tabSales Invoice`.customer_name, `tabSales Invoice`.customer_group, `tabSales Invoice Item`.so_detail, `tabSales Invoice`.update_stock, `tabSales Invoice Item`.uom, `tabSales Invoice Item`.qty {0} - from `tabSales Invoice`, `tabSales Invoice Item` - where `tabSales Invoice`.name = `tabSales Invoice Item`.parent - and `tabSales Invoice`.docstatus = 1 {1} + from `tabSales Invoice`, `tabSales Invoice Item`, `tabItem` + where `tabSales Invoice`.name = `tabSales Invoice Item`.parent and + `tabItem`.name = `tabSales Invoice Item`.`item_code` and + `tabSales Invoice`.docstatus = 1 {1} """.format( additional_query_columns or "", conditions ), From e1a5a7006f898cb63714be0f2360ef8ecfb0d861 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 28 Jun 2023 04:56:35 +0000 Subject: [PATCH 10/20] chore(release): Bumped to Version 14.27.13 ## [14.27.13](https://github.com/frappe/erpnext/compare/v14.27.12...v14.27.13) (2023-06-28) ### Performance Improvements * improve item wise register reports ([#35908](https://github.com/frappe/erpnext/issues/35908)) ([189954e](https://github.com/frappe/erpnext/commit/189954eaf19f45758f1b39146c5bdc5dbd9eee05)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 254b136d04f..5a739ca1c68 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.27.12" +__version__ = "14.27.13" def get_default_company(user=None): From 4f9c28cd2265cb043527d960ecf8b575ec722b71 Mon Sep 17 00:00:00 2001 From: Anand Baburajan Date: Wed, 28 Jun 2023 20:15:40 +0530 Subject: [PATCH 11/20] fix: asset movement (#35918) fix: asset movement fixes (cherry picked from commit e16c14863b52aaa7856c799ad64fe977d4a4fbbe) --- .../doctype/asset_movement/asset_movement.js | 18 +++++++++------- .../asset_movement/asset_movement.json | 7 +++++-- .../doctype/asset_movement/asset_movement.py | 19 +++++++---------- .../asset_movement/test_asset_movement.py | 21 ++++++++++++++----- 4 files changed, 38 insertions(+), 27 deletions(-) diff --git a/erpnext/assets/doctype/asset_movement/asset_movement.js b/erpnext/assets/doctype/asset_movement/asset_movement.js index 2df7db97446..f9c600731b3 100644 --- a/erpnext/assets/doctype/asset_movement/asset_movement.js +++ b/erpnext/assets/doctype/asset_movement/asset_movement.js @@ -70,19 +70,21 @@ frappe.ui.form.on('Asset Movement', { else if (frm.doc.purpose === 'Issue') { fieldnames_to_be_altered = { target_location: { read_only: 1, reqd: 0 }, - source_location: { read_only: 1, reqd: 1 }, + source_location: { read_only: 1, reqd: 0 }, from_employee: { read_only: 1, reqd: 0 }, to_employee: { read_only: 0, reqd: 1 } }; } - Object.keys(fieldnames_to_be_altered).forEach(fieldname => { - let property_to_be_altered = fieldnames_to_be_altered[fieldname]; - Object.keys(property_to_be_altered).forEach(property => { - let value = property_to_be_altered[property]; - frm.set_df_property(fieldname, property, value, cdn, 'assets'); + if (fieldnames_to_be_altered) { + Object.keys(fieldnames_to_be_altered).forEach(fieldname => { + let property_to_be_altered = fieldnames_to_be_altered[fieldname]; + Object.keys(property_to_be_altered).forEach(property => { + let value = property_to_be_altered[property]; + frm.fields_dict['assets'].grid.update_docfield_property(fieldname, property, value); + }); }); - }); - frm.refresh_field('assets'); + frm.refresh_field('assets'); + } } }); diff --git a/erpnext/assets/doctype/asset_movement/asset_movement.json b/erpnext/assets/doctype/asset_movement/asset_movement.json index bdce639b039..5382f9e75f2 100644 --- a/erpnext/assets/doctype/asset_movement/asset_movement.json +++ b/erpnext/assets/doctype/asset_movement/asset_movement.json @@ -37,6 +37,7 @@ "reqd": 1 }, { + "default": "Now", "fieldname": "transaction_date", "fieldtype": "Datetime", "in_list_view": 1, @@ -95,10 +96,11 @@ "index_web_pages_for_search": 1, "is_submittable": 1, "links": [], - "modified": "2021-01-22 12:30:55.295670", + "modified": "2023-06-28 16:54:26.571083", "modified_by": "Administrator", "module": "Assets", "name": "Asset Movement", + "naming_rule": "Expression", "owner": "Administrator", "permissions": [ { @@ -148,5 +150,6 @@ } ], "sort_field": "modified", - "sort_order": "DESC" + "sort_order": "DESC", + "states": [] } \ No newline at end of file diff --git a/erpnext/assets/doctype/asset_movement/asset_movement.py b/erpnext/assets/doctype/asset_movement/asset_movement.py index 143f215db2e..b58ca10482b 100644 --- a/erpnext/assets/doctype/asset_movement/asset_movement.py +++ b/erpnext/assets/doctype/asset_movement/asset_movement.py @@ -28,25 +28,20 @@ class AssetMovement(Document): def validate_location(self): for d in self.assets: if self.purpose in ["Transfer", "Issue"]: - if not d.source_location: - d.source_location = frappe.db.get_value("Asset", d.asset, "location") - - if not d.source_location: - frappe.throw(_("Source Location is required for the Asset {0}").format(d.asset)) - + current_location = frappe.db.get_value("Asset", d.asset, "location") if d.source_location: - current_location = frappe.db.get_value("Asset", d.asset, "location") - if current_location != d.source_location: frappe.throw( _("Asset {0} does not belongs to the location {1}").format(d.asset, d.source_location) ) + else: + d.source_location = current_location if self.purpose == "Issue": if d.target_location: frappe.throw( _( - "Issuing cannot be done to a location. Please enter employee who has issued Asset {0}" + "Issuing cannot be done to a location. Please enter employee to issue the Asset {0} to" ).format(d.asset), title=_("Incorrect Movement Purpose"), ) @@ -107,12 +102,12 @@ class AssetMovement(Document): ) def on_submit(self): - self.set_latest_location_in_asset() + self.set_latest_location_and_custodian_in_asset() def on_cancel(self): - self.set_latest_location_in_asset() + self.set_latest_location_and_custodian_in_asset() - def set_latest_location_in_asset(self): + def set_latest_location_and_custodian_in_asset(self): current_location, current_employee = "", "" cond = "1=1" diff --git a/erpnext/assets/doctype/asset_movement/test_asset_movement.py b/erpnext/assets/doctype/asset_movement/test_asset_movement.py index 72c05752c57..27e7e557f19 100644 --- a/erpnext/assets/doctype/asset_movement/test_asset_movement.py +++ b/erpnext/assets/doctype/asset_movement/test_asset_movement.py @@ -47,7 +47,7 @@ class TestAssetMovement(unittest.TestCase): if not frappe.db.exists("Location", "Test Location 2"): frappe.get_doc({"doctype": "Location", "location_name": "Test Location 2"}).insert() - movement1 = create_asset_movement( + create_asset_movement( purpose="Transfer", company=asset.company, assets=[ @@ -58,7 +58,7 @@ class TestAssetMovement(unittest.TestCase): ) self.assertEqual(frappe.db.get_value("Asset", asset.name, "location"), "Test Location 2") - create_asset_movement( + movement1 = create_asset_movement( purpose="Transfer", company=asset.company, assets=[ @@ -70,21 +70,32 @@ class TestAssetMovement(unittest.TestCase): self.assertEqual(frappe.db.get_value("Asset", asset.name, "location"), "Test Location") movement1.cancel() - self.assertEqual(frappe.db.get_value("Asset", asset.name, "location"), "Test Location") + self.assertEqual(frappe.db.get_value("Asset", asset.name, "location"), "Test Location 2") employee = make_employee("testassetmovemp@example.com", company="_Test Company") create_asset_movement( purpose="Issue", company=asset.company, - assets=[{"asset": asset.name, "source_location": "Test Location", "to_employee": employee}], + assets=[{"asset": asset.name, "source_location": "Test Location 2", "to_employee": employee}], reference_doctype="Purchase Receipt", reference_name=pr.name, ) - # after issuing asset should belong to an employee not at a location + # after issuing, asset should belong to an employee not at a location self.assertEqual(frappe.db.get_value("Asset", asset.name, "location"), None) self.assertEqual(frappe.db.get_value("Asset", asset.name, "custodian"), employee) + create_asset_movement( + purpose="Receipt", + company=asset.company, + assets=[{"asset": asset.name, "from_employee": employee, "target_location": "Test Location"}], + reference_doctype="Purchase Receipt", + reference_name=pr.name, + ) + + # after receiving, asset should belong to a location not at an employee + self.assertEqual(frappe.db.get_value("Asset", asset.name, "location"), "Test Location") + def test_last_movement_cancellation(self): pr = make_purchase_receipt( item_code="Macbook Pro", qty=1, rate=100000.0, location="Test Location" From 5b276428807bfb81db60bcce51818dbf7adf83b9 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 28 Jun 2023 15:26:36 +0000 Subject: [PATCH 12/20] chore(release): Bumped to Version 14.27.14 ## [14.27.14](https://github.com/frappe/erpnext/compare/v14.27.13...v14.27.14) (2023-06-28) ### Bug Fixes * asset movement ([#35918](https://github.com/frappe/erpnext/issues/35918)) ([4f9c28c](https://github.com/frappe/erpnext/commit/4f9c28cd2265cb043527d960ecf8b575ec722b71)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 5a739ca1c68..5d308202516 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.27.13" +__version__ = "14.27.14" def get_default_company(user=None): From 29ea5cfc213a15fa98fa9ba0b9e08fb474a68969 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 28 Jun 2023 16:04:31 +0000 Subject: [PATCH 13/20] chore(release): Bumped to Version 14.28.0 # [14.28.0](https://github.com/frappe/erpnext/compare/v14.27.14...v14.28.0) (2023-06-28) ### Bug Fixes * asset capitalization ([#35832](https://github.com/frappe/erpnext/issues/35832)) ([fb823b5](https://github.com/frappe/erpnext/commit/fb823b53d1d9a631035016fa3b33003bf8ce297a)) * asset movement ([#35918](https://github.com/frappe/erpnext/issues/35918)) ([e16c148](https://github.com/frappe/erpnext/commit/e16c14863b52aaa7856c799ad64fe977d4a4fbbe)) * delivery trip driver is only required on submit (backport [#35876](https://github.com/frappe/erpnext/issues/35876)) ([#35893](https://github.com/frappe/erpnext/issues/35893)) ([fc051d1](https://github.com/frappe/erpnext/commit/fc051d143c14d137908aa09c5cac83c7133392ba)) * don't allow to make reposting entry for closing stock balance period ([e68b088](https://github.com/frappe/erpnext/commit/e68b08817e0577a640c0cf19707b02b9b69036de)) * filter parent warehouses not showing (backport [#35897](https://github.com/frappe/erpnext/issues/35897)) ([#35899](https://github.com/frappe/erpnext/issues/35899)) ([87ba196](https://github.com/frappe/erpnext/commit/87ba19647311c1b7b7b8aa7724b1bd773dfce440)) * incorrect cost center error in bank reconciliation ([cacb0f6](https://github.com/frappe/erpnext/commit/cacb0f6fdedd292102840e1cffaa7af0364b0fbf)) * issue of asset value_after_depreciation field getting updated twice if workflow is enabled in Journal Entry (backport [#35821](https://github.com/frappe/erpnext/issues/35821)) ([#35827](https://github.com/frappe/erpnext/issues/35827)) ([20f2bef](https://github.com/frappe/erpnext/commit/20f2bef55f13f862a17dbc3ecfef5743661ec946)) * make credit note and debit note exclusive ([#35781](https://github.com/frappe/erpnext/issues/35781)) ([fafb46e](https://github.com/frappe/erpnext/commit/fafb46eebd87b684f634c1207fdfce9219ecc1c2)) * multiple Work Orders agaist same production plan ([8ddfc34](https://github.com/frappe/erpnext/commit/8ddfc34c304928c848999825bba6a5ca05d7942e)) * no permission for accounts settings on payment reconciliation ([200ddbf](https://github.com/frappe/erpnext/commit/200ddbf66c1e82016c3356c2012f209730e407fb)) * Payment Term must be mandatory if `Allocate Payment based on ..` is checked ([#35798](https://github.com/frappe/erpnext/issues/35798)) ([3dd3935](https://github.com/frappe/erpnext/commit/3dd3935e7612b056bb881f241d50656386f86c15)) * POS Closing Entry load all invoices with one request on save ([#35819](https://github.com/frappe/erpnext/issues/35819)) ([8ecca2a](https://github.com/frappe/erpnext/commit/8ecca2a1cf93dbebdc379f4b7036a8d728664837)) * reconcile invoice against credit note. ([#35604](https://github.com/frappe/erpnext/issues/35604)) ([5c388a1](https://github.com/frappe/erpnext/commit/5c388a132fd79d4b26ca40b894f0b661bccf756f)) * Remove special treatment for P&L Accounts ([#35602](https://github.com/frappe/erpnext/issues/35602)) ([b023448](https://github.com/frappe/erpnext/commit/b0234489ca39659c3d5f6385233da42c8c39bb24)) * Set Asset cost center default as PR or PI Item Cost Center while auto creating ([#35844](https://github.com/frappe/erpnext/issues/35844)) ([4a7d75b](https://github.com/frappe/erpnext/commit/4a7d75b5cc89063b5bd230251d13598d7d51e3b6)) * show non-depreciable assets in fixed asset register ([#35858](https://github.com/frappe/erpnext/issues/35858)) ([42d0944](https://github.com/frappe/erpnext/commit/42d09448eed316268d9a5a2c9e25791bc48fa326)) * TDS amount calculation post LDC breach ([851b887](https://github.com/frappe/erpnext/commit/851b8871b239f56d4625a80e8bd531d642e9b066)) * use correct fieldname for purchase receipt column in item_wise_purchase_register report ([#35828](https://github.com/frappe/erpnext/issues/35828)) ([8f13b48](https://github.com/frappe/erpnext/commit/8f13b484a942126dbbc028481f7d7ae4106da9ce)) * **ux:** PO Get Items From Open Material Requests (backport [#35894](https://github.com/frappe/erpnext/issues/35894)) ([#35895](https://github.com/frappe/erpnext/issues/35895)) ([2ef2057](https://github.com/frappe/erpnext/commit/2ef2057f44690565d33b7d4c1695e4ec440e3114)) ### Features * Auto set Party in Bank Transaction ([#34675](https://github.com/frappe/erpnext/issues/34675)) ([d53b197](https://github.com/frappe/erpnext/commit/d53b1978962f7e5baa1c5069bc624dc558705725)) * Provision to send Accounts Receivable Reports using Process SOA ([#35789](https://github.com/frappe/erpnext/issues/35789)) ([21d560c](https://github.com/frappe/erpnext/commit/21d560cd1963a7254bd40cc0389a9eb3cab31d0b)), closes [#35707](https://github.com/frappe/erpnext/issues/35707) ### Performance Improvements * improve item wise register reports ([#35908](https://github.com/frappe/erpnext/issues/35908)) ([33ee011](https://github.com/frappe/erpnext/commit/33ee01174bb909ee46bb3d714d6f94fa0aefe48f)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 5d308202516..cd4d37676ee 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.27.14" +__version__ = "14.28.0" def get_default_company(user=None): From cec3cdec6609379394cb1d740e9f5a45f3d416bf Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Sat, 1 Jul 2023 11:30:46 +0530 Subject: [PATCH 14/20] fix: reposting has not changed valuation rate (cherry picked from commit c0c693d8b0faf42089314cf43f4fc117f45de4b4) --- .../purchase_receipt/test_purchase_receipt.py | 115 ++++++++++++++++++ erpnext/stock/stock_ledger.py | 6 + 2 files changed, 121 insertions(+) diff --git a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py index 3ed480f88da..4743f3a4d7f 100644 --- a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py @@ -1804,6 +1804,121 @@ class TestPurchaseReceipt(FrappeTestCase): self.assertEqual(abs(data["stock_value_difference"]), 400.00) + def test_purchase_receipt_with_backdated_landed_cost_voucher(self): + from erpnext.controllers.sales_and_purchase_return import make_return_doc + from erpnext.stock.doctype.landed_cost_voucher.test_landed_cost_voucher import ( + create_landed_cost_voucher, + ) + from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry + + item_code = "_Test Purchase Item With Landed Cost" + create_item(item_code) + + warehouse = create_warehouse("_Test Purchase Warehouse With Landed Cost") + warehouse1 = create_warehouse("_Test Purchase Warehouse With Landed Cost 1") + warehouse2 = create_warehouse("_Test Purchase Warehouse With Landed Cost 2") + warehouse3 = create_warehouse("_Test Purchase Warehouse With Landed Cost 3") + + pr = make_purchase_receipt( + item_code=item_code, + warehouse=warehouse, + posting_date=add_days(today(), -10), + posting_time="10:59:59", + qty=100, + rate=275.00, + ) + + pr_return = make_return_doc("Purchase Receipt", pr.name) + pr_return.posting_date = add_days(today(), -9) + pr_return.items[0].qty = 2 * -1 + pr_return.items[0].received_qty = 2 * -1 + pr_return.submit() + + ste1 = make_stock_entry( + purpose="Material Transfer", + posting_date=add_days(today(), -8), + source=warehouse, + target=warehouse1, + item_code=item_code, + qty=20, + company=pr.company, + ) + + ste1.reload() + self.assertEqual(ste1.items[0].valuation_rate, 275.00) + + ste2 = make_stock_entry( + purpose="Material Transfer", + posting_date=add_days(today(), -7), + source=warehouse, + target=warehouse2, + item_code=item_code, + qty=20, + company=pr.company, + ) + + ste2.reload() + self.assertEqual(ste2.items[0].valuation_rate, 275.00) + + ste3 = make_stock_entry( + purpose="Material Transfer", + posting_date=add_days(today(), -6), + source=warehouse, + target=warehouse3, + item_code=item_code, + qty=20, + company=pr.company, + ) + + ste3.reload() + self.assertEqual(ste3.items[0].valuation_rate, 275.00) + + ste4 = make_stock_entry( + purpose="Material Transfer", + posting_date=add_days(today(), -5), + source=warehouse1, + target=warehouse, + item_code=item_code, + qty=20, + company=pr.company, + ) + + ste4.reload() + self.assertEqual(ste4.items[0].valuation_rate, 275.00) + + ste5 = make_stock_entry( + purpose="Material Transfer", + posting_date=add_days(today(), -4), + source=warehouse, + target=warehouse1, + item_code=item_code, + qty=20, + company=pr.company, + ) + + ste5.reload() + self.assertEqual(ste5.items[0].valuation_rate, 275.00) + + create_landed_cost_voucher("Purchase Receipt", pr.name, pr.company, charges=2500 * -1) + + pr.reload() + valuation_rate = pr.items[0].valuation_rate + + ste1.reload() + self.assertEqual(ste1.items[0].valuation_rate, valuation_rate) + + ste2.reload() + self.assertEqual(ste2.items[0].valuation_rate, valuation_rate) + + ste3.reload() + self.assertEqual(ste3.items[0].valuation_rate, valuation_rate) + + ste4.reload() + self.assertEqual(ste4.items[0].valuation_rate, valuation_rate) + + ste5.reload() + self.assertEqual(ste5.items[0].valuation_rate, valuation_rate) + def prepare_data_for_internal_transfer(): from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_internal_supplier diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py index 9c399168175..e0de9913f08 100644 --- a/erpnext/stock/stock_ledger.py +++ b/erpnext/stock/stock_ledger.py @@ -513,6 +513,7 @@ class update_entries_after(object): def update_distinct_item_warehouses(self, dependant_sle): key = (dependant_sle.item_code, dependant_sle.warehouse) val = frappe._dict({"sle": dependant_sle}) + if key not in self.distinct_item_warehouses: self.distinct_item_warehouses[key] = val self.new_items_found = True @@ -524,6 +525,9 @@ class update_entries_after(object): val.sle_changed = True self.distinct_item_warehouses[key] = val self.new_items_found = True + elif self.distinct_item_warehouses[key].get("reposting_status"): + self.distinct_item_warehouses[key] = val + self.new_items_found = True def process_sle(self, sle): from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos @@ -1255,6 +1259,8 @@ def get_sle_by_voucher_detail_no(voucher_detail_no, excluded_sle=None): [ "item_code", "warehouse", + "actual_qty", + "qty_after_transaction", "posting_date", "posting_time", "timestamp(posting_date, posting_time) as timestamp", From 87c0417e22f54bf7659629b2f9dfde7048ea194e Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Sun, 2 Jul 2023 05:49:11 +0000 Subject: [PATCH 15/20] chore(release): Bumped to Version 14.28.1 ## [14.28.1](https://github.com/frappe/erpnext/compare/v14.28.0...v14.28.1) (2023-07-02) ### Bug Fixes * reposting has not changed valuation rate ([cec3cde](https://github.com/frappe/erpnext/commit/cec3cdec6609379394cb1d740e9f5a45f3d416bf)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index cd4d37676ee..c75c205d37a 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.28.0" +__version__ = "14.28.1" def get_default_company(user=None): From f360bdcbf6d54e90e9a24088147a77446b20dd0c Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 5 Jul 2023 09:48:12 +0000 Subject: [PATCH 16/20] chore(release): Bumped to Version 14.29.0 # [14.29.0](https://github.com/frappe/erpnext/compare/v14.28.1...v14.29.0) (2023-07-05) ### Bug Fixes * Expense Account filter in Sales Invoice ([#35944](https://github.com/frappe/erpnext/issues/35944)) ([a485e4e](https://github.com/frappe/erpnext/commit/a485e4e802d48c10e59205b111bd3e04c2fccc09)) * get base grand total while pulling reference details in PE ([2e2c23a](https://github.com/frappe/erpnext/commit/2e2c23aa0fc9b4d56e805c8a4cefd71efdb4c38b)) * handle loan_repayment's posting_date datetime in bank_clearance_summary report ([#36004](https://github.com/frappe/erpnext/issues/36004)) ([937e1fb](https://github.com/frappe/erpnext/commit/937e1fb0245af291789ccd88f168d0402d9a00d8)) * Netherlands - Grootboekschema COA structure ([#35991](https://github.com/frappe/erpnext/issues/35991)) ([13f3ebf](https://github.com/frappe/erpnext/commit/13f3ebf915ba36b10b6d616d5a942307b9b71b66)) * project filtering based on company in P&L Report ([#35943](https://github.com/frappe/erpnext/issues/35943)) ([8de1d86](https://github.com/frappe/erpnext/commit/8de1d8663f67fb491f07f10ecef31e429538dda8)) * remove debug flag from sql ([646440f](https://github.com/frappe/erpnext/commit/646440fd5539b31062b4363c15d3393c004f1b17)) * reposting has not changed valuation rate ([c0c693d](https://github.com/frappe/erpnext/commit/c0c693d8b0faf42089314cf43f4fc117f45de4b4)) * Update no copy for received_qty field ([#35965](https://github.com/frappe/erpnext/issues/35965)) ([c330f47](https://github.com/frappe/erpnext/commit/c330f476802fd2ced925ebf17da79e46a3bdf4f4)) ### Features * **accounts:** standardize additional columns implementation for sales/purchase reports ([#36000](https://github.com/frappe/erpnext/issues/36000)) ([47c6d90](https://github.com/frappe/erpnext/commit/47c6d9099b4a449865a8ba9e2e4820ba4d7c71be)) * add method for ordered quantity in supplier scorecard (backport [#35930](https://github.com/frappe/erpnext/issues/35930)) ([#35968](https://github.com/frappe/erpnext/issues/35968)) ([a974091](https://github.com/frappe/erpnext/commit/a974091678fdeef31e970e6da0d0308a2d2d716a)) * add voucher-wise balance report logic ([6842902](https://github.com/frappe/erpnext/commit/684290233f4f2741e7a018b4b006180e185b5350)) * allow the partial return of components against SCO (backport [#35935](https://github.com/frappe/erpnext/issues/35935)) ([#35938](https://github.com/frappe/erpnext/issues/35938)) ([6f50ad6](https://github.com/frappe/erpnext/commit/6f50ad685e6e4b838608cac0709f08dd95d459f7)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index c75c205d37a..2328de016a0 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.28.1" +__version__ = "14.29.0" def get_default_company(user=None): From 03e458390b8f06d84a6fa99a0c9f20bb158372d6 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 5 Jul 2023 21:38:30 +0530 Subject: [PATCH 17/20] fix(Payment Entry): compare rounded amount (#36011) fix(Payment Entry): compare rounded amount (#36011) (cherry picked from commit 4badac8e9e43473c663c49f3f4d3fa4bf3172941) Co-authored-by: Raffael Meyer <14891507+barredterra@users.noreply.github.com> (cherry picked from commit d80b0aa157be79eee966b5bbe9715c84fdc9e204) --- erpnext/accounts/doctype/payment_entry/payment_entry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py index 371e8138567..a7d3435aa03 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -194,7 +194,7 @@ class PaymentEntry(AccountsController): # The reference has already been partly paid elif ( latest.outstanding_amount < latest.invoice_amount - and d.outstanding_amount != latest.outstanding_amount + and flt(d.outstanding_amount, d.precision("outstanding_amount")) != latest.outstanding_amount ): frappe.throw( _( From 78318964c711798c4ae0bbfc7ca49788fd0591f2 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Wed, 5 Jul 2023 16:23:44 +0000 Subject: [PATCH 18/20] chore(release): Bumped to Version 14.29.1 ## [14.29.1](https://github.com/frappe/erpnext/compare/v14.29.0...v14.29.1) (2023-07-05) ### Bug Fixes * **Payment Entry:** compare rounded amount ([#36011](https://github.com/frappe/erpnext/issues/36011)) ([03e4583](https://github.com/frappe/erpnext/commit/03e458390b8f06d84a6fa99a0c9f20bb158372d6)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 2328de016a0..d7283dbaa42 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.29.0" +__version__ = "14.29.1" def get_default_company(user=None): From 8c041eb424e57d632ae79e4629448e51d4baed65 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Mon, 10 Jul 2023 17:06:02 +0530 Subject: [PATCH 19/20] fix: Delivery Note return valuation (cherry picked from commit 6a10ae662ce102dd4014a85a2dd6a51a87692652) (cherry picked from commit 296f312e7f0e9a292ab859233a8950f69cfa9ab4) --- .../controllers/sales_and_purchase_return.py | 6 +++- .../delivery_note/test_delivery_note.py | 31 +++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/erpnext/controllers/sales_and_purchase_return.py b/erpnext/controllers/sales_and_purchase_return.py index 401c6b03383..b5d8246c116 100644 --- a/erpnext/controllers/sales_and_purchase_return.py +++ b/erpnext/controllers/sales_and_purchase_return.py @@ -617,7 +617,11 @@ def get_filters( if reference_voucher_detail_no: filters["voucher_detail_no"] = reference_voucher_detail_no - if item_row and item_row.get("warehouse"): + if ( + voucher_type in ["Purchase Receipt", "Purchase Invoice"] + and item_row + and item_row.get("warehouse") + ): filters["warehouse"] = item_row.get("warehouse") return filters diff --git a/erpnext/stock/doctype/delivery_note/test_delivery_note.py b/erpnext/stock/doctype/delivery_note/test_delivery_note.py index 903e2af3cb3..5d8efd5d9dc 100644 --- a/erpnext/stock/doctype/delivery_note/test_delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/test_delivery_note.py @@ -338,6 +338,37 @@ class TestDeliveryNote(FrappeTestCase): self.assertEqual(dn.per_returned, 100) self.assertEqual(dn.status, "Return Issued") + def test_delivery_note_return_valuation_on_different_warehuose(self): + from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse + + company = frappe.db.get_value("Warehouse", "Stores - TCP1", "company") + item_code = "Test Return Valuation For DN" + make_item("Test Return Valuation For DN", {"is_stock_item": 1}) + return_warehouse = create_warehouse("Returned Test Warehouse", company=company) + + make_stock_entry(item_code=item_code, target="Stores - TCP1", qty=5, basic_rate=150) + + dn = create_delivery_note( + item_code=item_code, + qty=5, + rate=500, + warehouse="Stores - TCP1", + company=company, + expense_account="Cost of Goods Sold - TCP1", + cost_center="Main - TCP1", + ) + + dn.submit() + self.assertEqual(dn.items[0].incoming_rate, 150) + + from erpnext.controllers.sales_and_purchase_return import make_return_doc + + return_dn = make_return_doc(dn.doctype, dn.name) + return_dn.items[0].warehouse = return_warehouse + return_dn.save().submit() + + self.assertEqual(return_dn.items[0].incoming_rate, 150) + def test_return_single_item_from_bundled_items(self): company = frappe.db.get_value("Warehouse", "Stores - TCP1", "company") From a2990923378568824a5bd8b8a5d595515f2936dd Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Mon, 10 Jul 2023 14:10:51 +0000 Subject: [PATCH 20/20] chore(release): Bumped to Version 14.29.2 ## [14.29.2](https://github.com/frappe/erpnext/compare/v14.29.1...v14.29.2) (2023-07-10) ### Bug Fixes * Delivery Note return valuation ([8c041eb](https://github.com/frappe/erpnext/commit/8c041eb424e57d632ae79e4629448e51d4baed65)) --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index d7283dbaa42..71544723f73 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -3,7 +3,7 @@ import inspect import frappe -__version__ = "14.29.1" +__version__ = "14.29.2" def get_default_company(user=None):