From 8d9305ee5feea229ce0430303c44bc9cc3c30482 Mon Sep 17 00:00:00 2001 From: anandbaburajan Date: Thu, 30 Mar 2023 12:50:33 +0530 Subject: [PATCH 1/9] fix: incorrect arg name in asset value adjustment (cherry picked from commit 2b0470d1f5a69f07d2b2e0cad0f4b1b649608665) --- .../doctype/asset_value_adjustment/asset_value_adjustment.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/assets/doctype/asset_value_adjustment/asset_value_adjustment.js b/erpnext/assets/doctype/asset_value_adjustment/asset_value_adjustment.js index ae0e1bda020..d07f40cdf42 100644 --- a/erpnext/assets/doctype/asset_value_adjustment/asset_value_adjustment.js +++ b/erpnext/assets/doctype/asset_value_adjustment/asset_value_adjustment.js @@ -49,7 +49,7 @@ frappe.ui.form.on('Asset Value Adjustment', { frm.call({ method: "erpnext.assets.doctype.asset.asset.get_asset_value_after_depreciation", args: { - asset: frm.doc.asset, + asset_name: frm.doc.asset, finance_book: frm.doc.finance_book }, callback: function(r) { From f47be467177900fd1824ee1b4bccdf54dd0b50b5 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Thu, 30 Mar 2023 11:47:32 +0530 Subject: [PATCH 2/9] fix: serial no with zero quantity issue in stock reco (cherry picked from commit 17131e5a02ac51ea2a605a180571b1f31bf02110) --- .../stock_reconciliation/stock_reconciliation.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py index 3f6a2c881b8..04d1a3a5e22 100644 --- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py +++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py @@ -4,7 +4,7 @@ from typing import Optional import frappe -from frappe import _, msgprint +from frappe import _, bold, msgprint from frappe.utils import cint, cstr, flt import erpnext @@ -89,7 +89,7 @@ class StockReconciliation(StockController): if item_dict.get("serial_nos"): item.current_serial_no = item_dict.get("serial_nos") - if self.purpose == "Stock Reconciliation" and not item.serial_no: + if self.purpose == "Stock Reconciliation" and not item.serial_no and item.qty: item.serial_no = item.current_serial_no item.current_qty = item_dict.get("qty") @@ -140,6 +140,14 @@ class StockReconciliation(StockController): self.validate_item(row.item_code, row) + if row.serial_no and not row.qty: + self.validation_messages.append( + _get_msg( + row_num, + f"Quantity should not be zero for the {bold(row.item_code)} since serial nos are specified", + ) + ) + # validate warehouse if not frappe.db.get_value("Warehouse", row.warehouse): self.validation_messages.append(_get_msg(row_num, _("Warehouse not found in the system"))) From 8510c398a4139a536ac90a71a5116c21a9e4cecd Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 30 Mar 2023 16:37:35 +0530 Subject: [PATCH 3/9] chore: auto fill asset name and available for use date (backport #34660) (#34662) * chore: auto fill asset name and available for use date (cherry picked from commit af3e807607ccb994e45919f967d4955e011a7915) # Conflicts: # erpnext/assets/doctype/asset/asset.json * Update asset.json --------- Co-authored-by: anandbaburajan --- erpnext/assets/doctype/asset/asset.js | 3 +++ erpnext/assets/doctype/asset/asset.json | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/erpnext/assets/doctype/asset/asset.js b/erpnext/assets/doctype/asset/asset.js index 21d846f6806..0923d0093f9 100644 --- a/erpnext/assets/doctype/asset/asset.js +++ b/erpnext/assets/doctype/asset/asset.js @@ -469,6 +469,9 @@ frappe.ui.form.on('Asset', { } else { frm.set_value('purchase_date', purchase_doc.posting_date); } + if (!frm.doc.is_existing_asset && !frm.doc.available_for_use_date) { + frm.set_value('available_for_use_date', frm.doc.purchase_date); + } const item = purchase_doc.items.find(item => item.item_code === frm.doc.item_code); if (!item) { doctype_field = frappe.scrub(doctype) diff --git a/erpnext/assets/doctype/asset/asset.json b/erpnext/assets/doctype/asset/asset.json index d581f52153e..3e93f0f03e3 100644 --- a/erpnext/assets/doctype/asset/asset.json +++ b/erpnext/assets/doctype/asset/asset.json @@ -81,6 +81,9 @@ "options": "ACC-ASS-.YYYY.-" }, { + "depends_on": "item_code", + "fetch_from": "item_code.item_name", + "fetch_if_empty": 1, "fieldname": "asset_name", "fieldtype": "Data", "in_list_view": 1, @@ -527,7 +530,7 @@ "table_fieldname": "accounts" } ], - "modified": "2023-01-25 17:45:48.649543", + "modified": "2023-03-30 15:07:41.542374", "modified_by": "Administrator", "module": "Assets", "name": "Asset", @@ -571,4 +574,4 @@ "states": [], "title_field": "asset_name", "track_changes": 1 -} \ No newline at end of file +} From a0df23415b629e91fd2a7c9c35ea306f03d4af92 Mon Sep 17 00:00:00 2001 From: Anand Baburajan Date: Thu, 30 Mar 2023 16:38:37 +0530 Subject: [PATCH 4/9] chore: improve asset depr posting failure msg (#34661) * chore: improve asset depr posting error msg * chore: add period * chore: improve msg (cherry picked from commit d999dea3e4f7397e6d649e15104199331db3bd45) --- erpnext/assets/doctype/asset/depreciation.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/erpnext/assets/doctype/asset/depreciation.py b/erpnext/assets/doctype/asset/depreciation.py index e72e0afb9ce..74625890a69 100644 --- a/erpnext/assets/doctype/asset/depreciation.py +++ b/erpnext/assets/doctype/asset/depreciation.py @@ -218,10 +218,16 @@ def notify_depr_entry_posting_error(failed_asset_names): asset_links = get_comma_separated_asset_links(failed_asset_names) message = ( - _("Hi,") - + "
" - + _("The following assets have failed to post depreciation entries: {0}").format(asset_links) + _("Hello,") + + "

" + + _("The following assets have failed to automatically post depreciation entries: {0}").format( + asset_links + ) + "." + + "

" + + _( + "Please raise a support ticket and share this email, or forward this email to your development team so that they can find the issue in the developer console by manually creating the depreciation entry via the asset's depreciation schedule table." + ) ) frappe.sendmail(recipients=recipients, subject=subject, message=message) From 3494c9ccb69adbe646b8c778bec03667fed90f0d Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Thu, 30 Mar 2023 16:20:42 +0530 Subject: [PATCH 5/9] fix: incorrect balance qty in the stock ledger report (cherry picked from commit cbdaab940d053268bc2592b3bf56c1b8ab389dde) --- erpnext/stock/report/stock_ledger/stock_ledger.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/erpnext/stock/report/stock_ledger/stock_ledger.py b/erpnext/stock/report/stock_ledger/stock_ledger.py index da17cdeb5ae..77bc4e004de 100644 --- a/erpnext/stock/report/stock_ledger/stock_ledger.py +++ b/erpnext/stock/report/stock_ledger/stock_ledger.py @@ -34,6 +34,9 @@ def execute(filters=None): conversion_factors.append(0) actual_qty = stock_value = 0 + if opening_row: + actual_qty = opening_row.get("qty_after_transaction") + stock_value = opening_row.get("stock_value") available_serial_nos = {} inventory_dimension_filters_applied = check_inventory_dimension_filters_applied(filters) From bb5eeb6bd6fa1f51a7545de657437393391d270c Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Wed, 29 Mar 2023 15:31:24 +0530 Subject: [PATCH 6/9] fix: posting time issue (cherry picked from commit 345e6facbee4e874b17559be75498b47fece1d1f) --- erpnext/stock/doctype/batch/batch.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/batch/batch.py b/erpnext/stock/doctype/batch/batch.py index f14288beb20..4a165212dce 100644 --- a/erpnext/stock/doctype/batch/batch.py +++ b/erpnext/stock/doctype/batch/batch.py @@ -6,7 +6,7 @@ import frappe from frappe import _ from frappe.model.document import Document from frappe.model.naming import make_autoname, revert_series_if_last -from frappe.utils import cint, flt, get_link_to_form +from frappe.utils import cint, flt, get_link_to_form, nowtime from frappe.utils.data import add_days from frappe.utils.jinja import render_template @@ -179,7 +179,11 @@ def get_batch_qty( out = 0 if batch_no and warehouse: cond = "" - if posting_date and posting_time: + + if posting_date: + if posting_time is None: + posting_time = nowtime() + cond = " and timestamp(posting_date, posting_time) <= timestamp('{0}', '{1}')".format( posting_date, posting_time ) From 61858a60c20ea67b627be97b3ce6e46a008717dd Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 30 Mar 2023 17:28:37 +0530 Subject: [PATCH 7/9] fix: plaid log_error syntax issue (backport #34642) (#34667) fix: plaid log_error syntax issue (#34642) (cherry picked from commit ddb17a888076975bb7af020ace98acc4d9caaf23) Co-authored-by: Richard Case <110036763+casesolved-co-uk@users.noreply.github.com> --- .../doctype/plaid_settings/plaid_settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.py b/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.py index f3aa6a37935..e57a30a88e1 100644 --- a/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.py +++ b/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.py @@ -220,7 +220,7 @@ def get_transactions(bank, bank_account=None, start_date=None, end_date=None): if e.code == "ITEM_LOGIN_REQUIRED": msg = _("There was an error syncing transactions.") + " " msg += _("Please refresh or reset the Plaid linking of the Bank {}.").format(bank) + " " - frappe.log_error(msg, title=_("Plaid Link Refresh Required")) + frappe.log_error(message=msg, title=_("Plaid Link Refresh Required")) return transactions From 5e03a4e9e2fe076707aacc701b910eeed6d605c5 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 31 Mar 2023 11:58:16 +0530 Subject: [PATCH 8/9] fix: Column value mismatch in COA blank template (#34658) fix: Column value mismatch in COA blank template (#34658) (cherry picked from commit 576575c22798a011a092196fdd8c7523d238c682) Co-authored-by: Deepesh Garg --- .../chart_of_accounts_importer.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/doctype/chart_of_accounts_importer/chart_of_accounts_importer.py b/erpnext/accounts/doctype/chart_of_accounts_importer/chart_of_accounts_importer.py index c676c97616c..e78f5f46dbc 100644 --- a/erpnext/accounts/doctype/chart_of_accounts_importer/chart_of_accounts_importer.py +++ b/erpnext/accounts/doctype/chart_of_accounts_importer/chart_of_accounts_importer.py @@ -325,14 +325,14 @@ def get_template(template_type): if template_type == "Blank Template": for root_type in get_root_types(): - writer.writerow(["", "", "", 1, "", root_type]) + writer.writerow(["", "", "", "", 1, "", root_type]) for account in get_mandatory_group_accounts(): - writer.writerow(["", "", "", 1, account, "Asset"]) + writer.writerow(["", "", "", "", 1, account, "Asset"]) for account_type in get_mandatory_account_types(): writer.writerow( - ["", "", "", 0, account_type.get("account_type"), account_type.get("root_type")] + ["", "", "", "", 0, account_type.get("account_type"), account_type.get("root_type")] ) else: writer = get_sample_template(writer) From 5e28d0234ef6e272d9252e55a5aa75dc08f02d9d Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 31 Mar 2023 11:58:45 +0530 Subject: [PATCH 9/9] fix: Total debit and credit while importing via Data Import (#34659) fix: Total debit and credit while importing via Data Import (#34659) (cherry picked from commit 7c42b72ee7882fc7963187e036c770a78e72cab1) Co-authored-by: Deepesh Garg --- erpnext/accounts/doctype/journal_entry/journal_entry.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index 56fe333e047..608267154b6 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -51,7 +51,7 @@ class JournalEntry(AccountsController): self.validate_multi_currency() self.set_amounts_in_company_currency() self.validate_debit_credit_amount() - + self.set_total_debit_credit() # Do not validate while importing via data import if not frappe.flags.in_import: self.validate_total_debit_and_credit() @@ -659,7 +659,6 @@ class JournalEntry(AccountsController): frappe.throw(_("Row {0}: Both Debit and Credit values cannot be zero").format(d.idx)) def validate_total_debit_and_credit(self): - self.set_total_debit_credit() if not (self.voucher_type == "Exchange Gain Or Loss" and self.multi_currency): if self.difference: frappe.throw(