style: format code with black
This commit is contained in:
@@ -45,9 +45,13 @@ def job(deserialized_data, from_doctype, to_doctype):
|
||||
frappe.db.rollback(save_point="before_creation_state")
|
||||
failed_history.append(e)
|
||||
failed.append(e)
|
||||
update_logger(doc_name, e, from_doctype, to_doctype, status="Failed", log_date=str(date.today()))
|
||||
update_logger(
|
||||
doc_name, e, from_doctype, to_doctype, status="Failed", log_date=str(date.today())
|
||||
)
|
||||
if not failed:
|
||||
update_logger(doc_name, None, from_doctype, to_doctype, status="Success", log_date=str(date.today()))
|
||||
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)
|
||||
|
||||
@@ -96,7 +100,7 @@ def task(doc_name, from_doctype, to_doctype):
|
||||
},
|
||||
"Purchase Receipt": {"Purchase Invoice": purchase_receipt.make_purchase_invoice},
|
||||
}
|
||||
if to_doctype in ['Advance Payment', 'Payment']:
|
||||
if to_doctype in ["Advance Payment", "Payment"]:
|
||||
obj = mapper[from_doctype][to_doctype](from_doctype, doc_name)
|
||||
else:
|
||||
obj = mapper[from_doctype][to_doctype](doc_name)
|
||||
@@ -142,9 +146,7 @@ def update_logger(doc_name, e, from_doctype, to_doctype, status, log_date=None,
|
||||
else:
|
||||
log_doc = get_logger_doc(log_date)
|
||||
if record_exists(log_doc, doc_name, status):
|
||||
append_data_to_logger(
|
||||
log_doc, doc_name, e, from_doctype, to_doctype, status, restarted
|
||||
)
|
||||
append_data_to_logger(log_doc, doc_name, e, from_doctype, to_doctype, status, restarted)
|
||||
log_doc.save()
|
||||
|
||||
|
||||
@@ -158,20 +160,20 @@ def show_job_status(failed_history, deserialized_data, to_doctype):
|
||||
|
||||
if len(failed_history) != 0 and len(failed_history) < len(deserialized_data):
|
||||
frappe.msgprint(
|
||||
_("""Creation of {0} partially successful.
|
||||
Check <b><a href="/app/bulk-transaction-log">Bulk Transaction Log</a></b>""").format(
|
||||
to_doctype
|
||||
),
|
||||
_(
|
||||
"""Creation of {0} partially successful.
|
||||
Check <b><a href="/app/bulk-transaction-log">Bulk Transaction Log</a></b>"""
|
||||
).format(to_doctype),
|
||||
title="Partially successful",
|
||||
indicator="orange",
|
||||
)
|
||||
|
||||
if len(failed_history) == len(deserialized_data):
|
||||
frappe.msgprint(
|
||||
_("""Creation of {0} failed.
|
||||
Check <b><a href="/app/bulk-transaction-log">Bulk Transaction Log</a></b>""").format(
|
||||
to_doctype
|
||||
),
|
||||
_(
|
||||
"""Creation of {0} failed.
|
||||
Check <b><a href="/app/bulk-transaction-log">Bulk Transaction Log</a></b>"""
|
||||
).format(to_doctype),
|
||||
title="Failed",
|
||||
indicator="red",
|
||||
)
|
||||
@@ -198,4 +200,4 @@ def mark_retrired_transaction(log_doc, doc_name):
|
||||
|
||||
log_doc.save()
|
||||
|
||||
return record
|
||||
return record
|
||||
|
||||
Reference in New Issue
Block a user