fix: Removed set_status after cancel from Expense Claim and Employee Advance (#25901)
* fix: removed set_status after cancel from hr doctypes * fix: semgrep on_submit issue * fix: sider * fix: spaces * fix: update flag for db_set
This commit is contained in:
parent
aaea5edbdb
commit
6c48a2ed79
@ -24,7 +24,6 @@ class EmployeeAdvance(Document):
|
|||||||
|
|
||||||
def on_cancel(self):
|
def on_cancel(self):
|
||||||
self.ignore_linked_doctypes = ('GL Entry')
|
self.ignore_linked_doctypes = ('GL Entry')
|
||||||
self.set_status()
|
|
||||||
|
|
||||||
def set_status(self):
|
def set_status(self):
|
||||||
if self.docstatus == 0:
|
if self.docstatus == 0:
|
||||||
@ -231,4 +230,4 @@ def get_voucher_type(mode_of_payment=None):
|
|||||||
if mode_of_payment_type == "Bank":
|
if mode_of_payment_type == "Bank":
|
||||||
voucher_type = "Bank Entry"
|
voucher_type = "Bank Entry"
|
||||||
|
|
||||||
return voucher_type
|
return voucher_type
|
||||||
|
@ -36,8 +36,8 @@ class ExpenseClaim(AccountsController):
|
|||||||
if self.task and not self.project:
|
if self.task and not self.project:
|
||||||
self.project = frappe.db.get_value("Task", self.task, "project")
|
self.project = frappe.db.get_value("Task", self.task, "project")
|
||||||
|
|
||||||
def set_status(self):
|
def set_status(self, update=False):
|
||||||
self.status = {
|
status = {
|
||||||
"0": "Draft",
|
"0": "Draft",
|
||||||
"1": "Submitted",
|
"1": "Submitted",
|
||||||
"2": "Cancelled"
|
"2": "Cancelled"
|
||||||
@ -45,14 +45,18 @@ class ExpenseClaim(AccountsController):
|
|||||||
|
|
||||||
paid_amount = flt(self.total_amount_reimbursed) + flt(self.total_advance_amount)
|
paid_amount = flt(self.total_amount_reimbursed) + flt(self.total_advance_amount)
|
||||||
precision = self.precision("grand_total")
|
precision = self.precision("grand_total")
|
||||||
if (self.is_paid or (flt(self.total_sanctioned_amount) > 0
|
if (self.is_paid or (flt(self.total_sanctioned_amount) > 0 and self.docstatus == 1
|
||||||
and flt(self.grand_total, precision) == flt(paid_amount, precision))) \
|
and flt(self.grand_total, precision) == flt(paid_amount, precision))) and self.approval_status == 'Approved':
|
||||||
and self.docstatus == 1 and self.approval_status == 'Approved':
|
status = "Paid"
|
||||||
self.status = "Paid"
|
|
||||||
elif flt(self.total_sanctioned_amount) > 0 and self.docstatus == 1 and self.approval_status == 'Approved':
|
elif flt(self.total_sanctioned_amount) > 0 and self.docstatus == 1 and self.approval_status == 'Approved':
|
||||||
self.status = "Unpaid"
|
status = "Unpaid"
|
||||||
elif self.docstatus == 1 and self.approval_status == 'Rejected':
|
elif self.docstatus == 1 and self.approval_status == 'Rejected':
|
||||||
self.status = 'Rejected'
|
status = 'Rejected'
|
||||||
|
|
||||||
|
if update:
|
||||||
|
self.db_set("status", status)
|
||||||
|
else:
|
||||||
|
self.status = status
|
||||||
|
|
||||||
def on_update(self):
|
def on_update(self):
|
||||||
share_doc_with_approver(self, self.expense_approver)
|
share_doc_with_approver(self, self.expense_approver)
|
||||||
@ -75,7 +79,7 @@ class ExpenseClaim(AccountsController):
|
|||||||
if self.is_paid:
|
if self.is_paid:
|
||||||
update_reimbursed_amount(self)
|
update_reimbursed_amount(self)
|
||||||
|
|
||||||
self.set_status()
|
self.set_status(update=True)
|
||||||
self.update_claimed_amount_in_employee_advance()
|
self.update_claimed_amount_in_employee_advance()
|
||||||
|
|
||||||
def on_cancel(self):
|
def on_cancel(self):
|
||||||
@ -87,7 +91,6 @@ class ExpenseClaim(AccountsController):
|
|||||||
if self.is_paid:
|
if self.is_paid:
|
||||||
update_reimbursed_amount(self)
|
update_reimbursed_amount(self)
|
||||||
|
|
||||||
self.set_status()
|
|
||||||
self.update_claimed_amount_in_employee_advance()
|
self.update_claimed_amount_in_employee_advance()
|
||||||
|
|
||||||
def update_claimed_amount_in_employee_advance(self):
|
def update_claimed_amount_in_employee_advance(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user