From 22a069d4b0b642fcd06ed4858731c30905930df9 Mon Sep 17 00:00:00 2001 From: Anurag Mishra Date: Mon, 16 Mar 2020 18:24:28 +0530 Subject: [PATCH] fix: Wrong status --- erpnext/hr/doctype/expense_claim/expense_claim.json | 4 +++- erpnext/hr/doctype/expense_claim/expense_claim.py | 2 +- erpnext/patches.txt | 1 + .../patches/v12_0/set_correct_status_for_expense_claim.py | 7 +++++++ 4 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 erpnext/patches/v12_0/set_correct_status_for_expense_claim.py diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.json b/erpnext/hr/doctype/expense_claim/expense_claim.json index 5c2f4901713..770b47709dd 100644 --- a/erpnext/hr/doctype/expense_claim/expense_claim.json +++ b/erpnext/hr/doctype/expense_claim/expense_claim.json @@ -278,6 +278,7 @@ "label": "More Details" }, { + "allow_on_submit": 1, "default": "Draft", "fieldname": "status", "fieldtype": "Select", @@ -366,7 +367,8 @@ "icon": "fa fa-money", "idx": 1, "is_submittable": 1, - "modified": "2019-11-08 14:13:08.964547", + "links": [], + "modified": "2020-03-16 18:11:07.861985", "modified_by": "Administrator", "module": "HR", "name": "Expense Claim", diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.py b/erpnext/hr/doctype/expense_claim/expense_claim.py index d29b3f75879..e9f15cdfb9a 100644 --- a/erpnext/hr/doctype/expense_claim/expense_claim.py +++ b/erpnext/hr/doctype/expense_claim/expense_claim.py @@ -45,7 +45,7 @@ class ExpenseClaim(AccountsController): paid_amount = flt(self.total_amount_reimbursed) + flt(self.total_advance_amount) precision = self.precision("grand_total") if (self.is_paid or (flt(self.total_sanctioned_amount) > 0 - and flt(self.grand_total, precision) == flt(paid_amount, precision))) \ + and flt(self.total_sanctioned_amount, precision) == flt(paid_amount, precision))) \ and self.docstatus == 1 and self.approval_status == 'Approved': self.status = "Paid" elif flt(self.total_sanctioned_amount) > 0 and self.docstatus == 1 and self.approval_status == 'Approved': diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 4e72d5ecd6b..ed14ecd4897 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -650,3 +650,4 @@ erpnext.patches.v12_0.update_price_or_product_discount erpnext.patches.v12_0.add_export_type_field_in_party_master erpnext.patches.v12_0.rename_bank_reconciliation_fields # 2020-01-22 erpnext.patches.v12_0.create_irs_1099_field_united_states +erpnext.patches.v12_0.set_correct_status_for_expense_claim diff --git a/erpnext/patches/v12_0/set_correct_status_for_expense_claim.py b/erpnext/patches/v12_0/set_correct_status_for_expense_claim.py new file mode 100644 index 00000000000..3d3980743e6 --- /dev/null +++ b/erpnext/patches/v12_0/set_correct_status_for_expense_claim.py @@ -0,0 +1,7 @@ +# Copyright (c) 2020, Frappe and Contributors +# License: GNU General Public License v3. See license.txt + +import frappe + +def execute(): + frappe.db.sql("update `tabExpense Claim` set status = 'Paid' where (total_advance_amount + total_amount_reimbursed ) = total_sanctioned_amount") \ No newline at end of file