From 516be870dfe4beb9046512143dab299314ca670c Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 20 Jul 2022 10:58:20 +0530 Subject: [PATCH] fix: Renamed status field to gle_processing_status --- .../period_closing_voucher.json | 8 ++++---- .../period_closing_voucher/period_closing_voucher.py | 12 ++++++------ .../test_period_closing_voucher.py | 2 ++ 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.json b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.json index 95742640c96..54a76b34196 100644 --- a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.json +++ b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.json @@ -13,7 +13,7 @@ "column_break1", "closing_account_head", "remarks", - "status", + "gle_processing_status", "error_message" ], "fields": [ @@ -88,14 +88,14 @@ }, { "depends_on": "eval:doc.docstatus!=0", - "fieldname": "status", + "fieldname": "gle_processing_status", "fieldtype": "Select", "label": "GL Entry Processing Status", "options": "In Progress\nCompleted\nFailed", "read_only": 1 }, { - "depends_on": "eval:doc.status=='Failed'", + "depends_on": "eval:doc.gle_processing_status=='Failed'", "fieldname": "error_message", "fieldtype": "Text", "label": "Error Message", @@ -106,7 +106,7 @@ "idx": 1, "is_submittable": 1, "links": [], - "modified": "2022-07-15 14:51:04.714154", + "modified": "2022-07-20 14:51:04.714154", "modified_by": "Administrator", "module": "Accounts", "name": "Period Closing Voucher", diff --git a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py index 3b890eef25f..866a94d04b1 100644 --- a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py +++ b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py @@ -19,11 +19,11 @@ class PeriodClosingVoucher(AccountsController): self.validate_posting_date() def on_submit(self): - self.db_set("status", "In Progress") + self.db_set("gle_processing_status", "In Progress") self.make_gl_entries() def on_cancel(self): - self.db_set("status", "In Progress") + self.db_set("gle_processing_status", "In Progress") self.ignore_linked_doctypes = ("GL Entry", "Stock Ledger Entry") gle_count = frappe.db.count( "GL Entry", @@ -196,13 +196,13 @@ def process_gl_entries(gl_entries): try: make_gl_entries(gl_entries, merge_entries=False) 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: frappe.db.rollback() frappe.log_error(e) 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: 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: frappe.db.rollback() 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") diff --git a/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py b/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py index 9f810f1826d..3dca58856be 100644 --- a/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py +++ b/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py @@ -59,6 +59,8 @@ class TestPeriodClosingVoucher(unittest.TestCase): """, (pcv.name), ) + pcv.reload() + self.assertEqual(pcv.gle_processing_status, "Completed") self.assertEqual(pcv_gle, expected_gle) def test_cost_center_wise_posting(self):