diff --git a/erpnext/hr/doctype/employee_advance/employee_advance.json b/erpnext/hr/doctype/employee_advance/employee_advance.json index cd8637755cc..79e49b0f614 100644 --- a/erpnext/hr/doctype/employee_advance/employee_advance.json +++ b/erpnext/hr/doctype/employee_advance/employee_advance.json @@ -303,7 +303,7 @@ "in_standard_filter": 0, "label": "Paid Amount", "length": 0, - "no_copy": 0, + "no_copy": 1, "options": "Company:company:default_currency", "permlevel": 0, "precision": "", @@ -334,13 +334,13 @@ "in_standard_filter": 0, "label": "Claimed Amount", "length": 0, - "no_copy": 0, + "no_copy": 1, "options": "Company:company:default_currency", "permlevel": 0, "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, - "read_only": 0, + "read_only": 1, "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, @@ -395,7 +395,7 @@ "label": "Status", "length": 0, "no_copy": 1, - "options": "Draft\nPaid\nUnpaid\nRejected\nClaimed\nSubmitted\nCancelled", + "options": "Draft\nPaid\nUnpaid\nClaimed\nCancelled", "permlevel": 0, "precision": "", "print_hide": 0, @@ -571,8 +571,8 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2017-12-07 16:31:48.931260", - "modified_by": "Administrator", + "modified": "2017-12-14 17:53:11.084810", + "modified_by": "nabinhait@gmail.com", "module": "HR", "name": "Employee Advance", "name_case": "", diff --git a/erpnext/hr/doctype/employee_advance/employee_advance.py b/erpnext/hr/doctype/employee_advance/employee_advance.py index 8fe5759d040..28547fb2859 100644 --- a/erpnext/hr/doctype/employee_advance/employee_advance.py +++ b/erpnext/hr/doctype/employee_advance/employee_advance.py @@ -23,12 +23,12 @@ class EmployeeAdvance(Document): self.set_status() def set_status(self): - if not self.status: + if self.docstatus == 0: self.status = "Draft" if self.docstatus == 1: - if flt(self.claimed_amount) == flt(self.paid_amount): + if self.claimed_amount and flt(self.claimed_amount) == flt(self.paid_amount): self.status = "Claimed" - elif self.advance_amount == flt(self.paid_amount): + elif self.paid_amount and self.advance_amount == flt(self.paid_amount): self.status = "Paid" else: self.status = "Unpaid" diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.json b/erpnext/hr/doctype/expense_claim/expense_claim.json index 4ccadb6a999..a005ae0e066 100644 --- a/erpnext/hr/doctype/expense_claim/expense_claim.json +++ b/erpnext/hr/doctype/expense_claim/expense_claim.json @@ -44,36 +44,6 @@ "set_only_once": 1, "unique": 0 }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "is_paid", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Is Paid", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -238,6 +208,37 @@ "unique": 0, "width": "160px" }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "eval:(doc.docstatus==0 || doc.is_paid)", + "fieldname": "is_paid", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Is Paid", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -1057,8 +1058,8 @@ "istable": 0, "max_attachments": 0, "menu_index": 0, - "modified": "2017-12-07 01:05:24.323540", - "modified_by": "Administrator", + "modified": "2017-12-14 17:40:02.959352", + "modified_by": "nabinhait@gmail.com", "module": "HR", "name": "Expense Claim", "name_case": "Title Case", diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.py b/erpnext/hr/doctype/expense_claim/expense_claim.py index 945de9dab75..d27675ccd7d 100644 --- a/erpnext/hr/doctype/expense_claim/expense_claim.py +++ b/erpnext/hr/doctype/expense_claim/expense_claim.py @@ -44,7 +44,8 @@ class ExpenseClaim(AccountsController): "2": "Cancelled" }[cstr(self.docstatus or 0)] - if self.total_sanctioned_amount > 0 and self.total_sanctioned_amount == self.total_amount_reimbursed \ + paid_amount = flt(self.total_amount_reimbursed) + flt(self.total_advance_amount) + if self.total_sanctioned_amount > 0 and self.total_sanctioned_amount == paid_amount\ and self.docstatus == 1 and self.approval_status == 'Approved': self.status = "Paid" elif self.total_sanctioned_amount > 0 and self.docstatus == 1 and self.approval_status == 'Approved':