Merge pull request #32394 from maharshivpatel/fix-payment-request-fetch-swift-number
fix: fetch swift number in payment request from bank doctype
diff --git a/erpnext/accounts/doctype/bank_clearance/bank_clearance.py b/erpnext/accounts/doctype/bank_clearance/bank_clearance.py
index 1a572d9..78c3526 100644
--- a/erpnext/accounts/doctype/bank_clearance/bank_clearance.py
+++ b/erpnext/accounts/doctype/bank_clearance/bank_clearance.py
@@ -99,7 +99,7 @@
.where(loan_disbursement.clearance_date.isnull())
.where(loan_disbursement.disbursement_account.isin([self.bank_account, self.account]))
.orderby(loan_disbursement.disbursement_date)
- .orderby(loan_disbursement.name, frappe.qb.desc)
+ .orderby(loan_disbursement.name, order=frappe.qb.desc)
).run(as_dict=1)
loan_repayment = frappe.qb.DocType("Loan Repayment")
@@ -126,7 +126,9 @@
if frappe.db.has_column("Loan Repayment", "repay_from_salary"):
query = query.where((loan_repayment.repay_from_salary == 0))
- query = query.orderby(loan_repayment.posting_date).orderby(loan_repayment.name, frappe.qb.desc)
+ query = query.orderby(loan_repayment.posting_date).orderby(
+ loan_repayment.name, order=frappe.qb.desc
+ )
loan_repayments = query.run(as_dict=True)
diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py
index c5eb7d8..9ede678 100644
--- a/erpnext/accounts/utils.py
+++ b/erpnext/accounts/utils.py
@@ -86,7 +86,7 @@
)
)
- query = query.orderby(FY.year_start_date, Order.desc)
+ query = query.orderby(FY.year_start_date, order=Order.desc)
fiscal_years = query.run(as_dict=True)
frappe.cache().hset("fiscal_years", company, fiscal_years)
diff --git a/erpnext/assets/doctype/asset/asset.json b/erpnext/assets/doctype/asset/asset.json
index 991df4e..f0505ff 100644
--- a/erpnext/assets/doctype/asset/asset.json
+++ b/erpnext/assets/doctype/asset/asset.json
@@ -388,7 +388,7 @@
"in_standard_filter": 1,
"label": "Status",
"no_copy": 1,
- "options": "Draft\nSubmitted\nPartially Depreciated\nFully Depreciated\nSold\nScrapped\nIn Maintenance\nOut of Order\nIssue\nReceipt",
+ "options": "Draft\nSubmitted\nPartially Depreciated\nFully Depreciated\nSold\nScrapped\nIn Maintenance\nOut of Order\nIssue\nReceipt\nCapitalized\nDecapitalized",
"read_only": 1
},
{
diff --git a/erpnext/assets/doctype/asset/asset.py b/erpnext/assets/doctype/asset/asset.py
index 8ac7ed6..ca6be9b 100644
--- a/erpnext/assets/doctype/asset/asset.py
+++ b/erpnext/assets/doctype/asset/asset.py
@@ -828,7 +828,9 @@
def update_maintenance_status():
- assets = frappe.get_all("Asset", filters={"docstatus": 1, "maintenance_required": 1})
+ assets = frappe.get_all(
+ "Asset", filters={"docstatus": 1, "maintenance_required": 1, "disposal_date": ("is", "not set")}
+ )
for asset in assets:
asset = frappe.get_doc("Asset", asset.name)
diff --git a/erpnext/assets/doctype/asset/test_asset.py b/erpnext/assets/doctype/asset/test_asset.py
index f72b524..370b13b 100644
--- a/erpnext/assets/doctype/asset/test_asset.py
+++ b/erpnext/assets/doctype/asset/test_asset.py
@@ -16,7 +16,11 @@
)
from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice
-from erpnext.assets.doctype.asset.asset import make_sales_invoice, split_asset
+from erpnext.assets.doctype.asset.asset import (
+ make_sales_invoice,
+ split_asset,
+ update_maintenance_status,
+)
from erpnext.assets.doctype.asset.depreciation import (
post_depreciation_entries,
restore_asset,
@@ -249,7 +253,9 @@
asset.gross_purchase_amount - asset.finance_books[0].value_after_depreciation,
asset.precision("gross_purchase_amount"),
)
- self.assertEquals(accumulated_depr_amount, 18000.0)
+ this_month_depr_amount = 9000.0 if get_last_day(date) == date else 0
+
+ self.assertEquals(accumulated_depr_amount, 18000.0 + this_month_depr_amount)
def test_gle_made_by_asset_sale(self):
date = nowdate()
@@ -300,6 +306,34 @@
si.cancel()
self.assertEqual(frappe.db.get_value("Asset", asset.name, "status"), "Partially Depreciated")
+ def test_asset_with_maintenance_required_status_after_sale(self):
+ asset = create_asset(
+ calculate_depreciation=1,
+ available_for_use_date="2020-06-06",
+ purchase_date="2020-01-01",
+ expected_value_after_useful_life=10000,
+ total_number_of_depreciations=3,
+ frequency_of_depreciation=10,
+ maintenance_required=1,
+ depreciation_start_date="2020-12-31",
+ submit=1,
+ )
+
+ post_depreciation_entries(date="2021-01-01")
+
+ si = make_sales_invoice(asset=asset.name, item_code="Macbook Pro", company="_Test Company")
+ si.customer = "_Test Customer"
+ si.due_date = nowdate()
+ si.get("items")[0].rate = 25000
+ si.insert()
+ si.submit()
+
+ self.assertEqual(frappe.db.get_value("Asset", asset.name, "status"), "Sold")
+
+ update_maintenance_status()
+
+ self.assertEqual(frappe.db.get_value("Asset", asset.name, "status"), "Sold")
+
def test_asset_splitting(self):
asset = create_asset(
calculate_depreciation=1,
@@ -1418,6 +1452,7 @@
"number_of_depreciations_booked": args.number_of_depreciations_booked or 0,
"gross_purchase_amount": args.gross_purchase_amount or 100000,
"purchase_receipt_amount": args.purchase_receipt_amount or 100000,
+ "maintenance_required": args.maintenance_required or 0,
"warehouse": args.warehouse or "_Test Warehouse - _TC",
"available_for_use_date": args.available_for_use_date or "2020-06-06",
"location": args.location or "Test Location",
diff --git a/erpnext/utilities/bulk_transaction.py b/erpnext/utilities/bulk_transaction.py
index bfcba07..eed7c12 100644
--- a/erpnext/utilities/bulk_transaction.py
+++ b/erpnext/utilities/bulk_transaction.py
@@ -9,7 +9,6 @@
def transaction_processing(data, from_doctype, to_doctype):
if isinstance(data, str):
deserialized_data = json.loads(data)
-
else:
deserialized_data = data
@@ -30,30 +29,29 @@
def job(deserialized_data, from_doctype, to_doctype):
- failed_history = []
- i = 0
+ fail_count = 0
for d in deserialized_data:
- failed = []
-
try:
- i += 1
doc_name = d.get("name")
frappe.db.savepoint("before_creation_state")
task(doc_name, from_doctype, to_doctype)
-
except Exception as e:
frappe.db.rollback(save_point="before_creation_state")
- failed_history.append(e)
- failed.append(e)
+ fail_count += 1
update_logger(
- doc_name, e, from_doctype, to_doctype, status="Failed", log_date=str(date.today())
+ doc_name,
+ str(frappe.get_traceback()),
+ from_doctype,
+ to_doctype,
+ status="Failed",
+ log_date=str(date.today()),
)
- if not failed:
+ else:
update_logger(
doc_name, None, from_doctype, to_doctype, status="Success", log_date=str(date.today())
)
- show_job_status(failed_history, deserialized_data, to_doctype)
+ show_job_status(fail_count, len(deserialized_data), to_doctype)
def task(doc_name, from_doctype, to_doctype):
@@ -94,7 +92,7 @@
"Purchase Invoice": purchase_order.make_purchase_invoice,
"Purchase Receipt": purchase_order.make_purchase_receipt,
},
- "Purhcase Invoice": {
+ "Purchase Invoice": {
"Purchase Receipt": purchase_invoice.make_purchase_receipt,
"Payment": payment_entry.get_payment_entry,
},
@@ -150,15 +148,14 @@
log_doc.save()
-def show_job_status(failed_history, deserialized_data, to_doctype):
- if not failed_history:
+def show_job_status(fail_count, deserialized_data_count, to_doctype):
+ if not fail_count:
frappe.msgprint(
_("Creation of {0} successful").format(to_doctype),
title="Successful",
indicator="green",
)
-
- if len(failed_history) != 0 and len(failed_history) < len(deserialized_data):
+ elif fail_count != 0 and fail_count < deserialized_data_count:
frappe.msgprint(
_(
"""Creation of {0} partially successful.
@@ -167,8 +164,7 @@
title="Partially successful",
indicator="orange",
)
-
- if len(failed_history) == len(deserialized_data):
+ else:
frappe.msgprint(
_(
"""Creation of {0} failed.
@@ -180,9 +176,7 @@
def record_exists(log_doc, doc_name, status):
-
record = mark_retrired_transaction(log_doc, doc_name)
-
if record and status == "Failed":
return False
elif record and status == "Success":
diff --git a/erpnext/www/book_appointment/index.css b/erpnext/www/book_appointment/index.css
index 2776108..3b1b97c 100644
--- a/erpnext/www/book_appointment/index.css
+++ b/erpnext/www/book_appointment/index.css
@@ -45,7 +45,7 @@
.time-slot.selected {
color: white;
- background: #5e64ff;
+ background: var(--primary-color);
}
.time-slot.selected .text-muted {