fix: Renamed status field to gle_processing_status

This commit is contained in:
Nabin Hait
2022-07-20 10:50:44 +05:30
parent cfb11f4b84
commit 1180135067
3 changed files with 11 additions and 10 deletions

View File

@@ -13,7 +13,7 @@
"column_break1", "column_break1",
"closing_account_head", "closing_account_head",
"remarks", "remarks",
"status", "gle_processing_status",
"error_message" "error_message"
], ],
"fields": [ "fields": [
@@ -88,14 +88,14 @@
}, },
{ {
"depends_on": "eval:doc.docstatus!=0", "depends_on": "eval:doc.docstatus!=0",
"fieldname": "status", "fieldname": "gle_processing_status",
"fieldtype": "Select", "fieldtype": "Select",
"label": "GL Entry Processing Status", "label": "GL Entry Processing Status",
"options": "In Progress\nCompleted\nFailed", "options": "In Progress\nCompleted\nFailed",
"read_only": 1 "read_only": 1
}, },
{ {
"depends_on": "eval:doc.status=='Failed'", "depends_on": "eval:doc.gle_processing_status=='Failed'",
"fieldname": "error_message", "fieldname": "error_message",
"fieldtype": "Text", "fieldtype": "Text",
"label": "Error Message", "label": "Error Message",
@@ -106,7 +106,7 @@
"idx": 1, "idx": 1,
"is_submittable": 1, "is_submittable": 1,
"links": [], "links": [],
"modified": "2022-07-15 14:51:04.714154", "modified": "2022-07-20 14:51:04.714154",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Period Closing Voucher", "name": "Period Closing Voucher",

View File

@@ -19,11 +19,11 @@ class PeriodClosingVoucher(AccountsController):
self.validate_posting_date() self.validate_posting_date()
def on_submit(self): def on_submit(self):
self.status = "In Progress" self.gle_processing_status = "In Progress"
self.make_gl_entries() self.make_gl_entries()
def on_cancel(self): def on_cancel(self):
self.status = "In Progress" self.gle_processing_status = "In Progress"
self.ignore_linked_doctypes = ("GL Entry", "Stock Ledger Entry") self.ignore_linked_doctypes = ("GL Entry", "Stock Ledger Entry")
gle_count = frappe.db.count( gle_count = frappe.db.count(
"GL Entry", "GL Entry",
@@ -196,13 +196,13 @@ def process_gl_entries(gl_entries):
try: try:
make_gl_entries(gl_entries, merge_entries=False) make_gl_entries(gl_entries, merge_entries=False)
frappe.db.set_value( frappe.db.set_value(
"Period Closing Voucher", gl_entries[0].get("voucher_no"), "status", "Completed" "Period Closing Voucher", gl_entries[0].get("voucher_no"), "gle_processing_status", "Completed"
) )
except Exception as e: except Exception as e:
frappe.db.rollback() frappe.db.rollback()
frappe.log_error(e) frappe.log_error(e)
frappe.db.set_value( frappe.db.set_value(
"Period Closing Voucher", gl_entries[0].get("voucher_no"), "status", "Failed" "Period Closing Voucher", gl_entries[0].get("voucher_no"), "gle_processing_status", "Failed"
) )
@@ -211,8 +211,8 @@ def make_reverse_gl_entries(voucher_type, voucher_no):
try: try:
make_reverse_gl_entries(voucher_type=voucher_type, voucher_no=voucher_no) make_reverse_gl_entries(voucher_type=voucher_type, voucher_no=voucher_no)
frappe.db.set_value("Period Closing Voucher", voucher_no, "status", "Completed") frappe.db.set_value("Period Closing Voucher", voucher_no, "gle_processing_status", "Completed")
except Exception as e: except Exception as e:
frappe.db.rollback() frappe.db.rollback()
frappe.log_error(e) frappe.log_error(e)
frappe.db.set_value("Period Closing Voucher", voucher_no, "status", "Failed") frappe.db.set_value("Period Closing Voucher", voucher_no, "gle_processing_status", "Failed")

View File

@@ -59,6 +59,7 @@ class TestPeriodClosingVoucher(unittest.TestCase):
""", """,
(pcv.name), (pcv.name),
) )
self.assetEqual(pcv.gle_processing_status, "Completed")
self.assertEqual(pcv_gle, expected_gle) self.assertEqual(pcv_gle, expected_gle)
def test_cost_center_wise_posting(self): def test_cost_center_wise_posting(self):