patch: Employee Advance return statuses

This commit is contained in:
Rucha Mahabal
2022-01-18 14:36:38 +05:30
parent 42e7a86a3b
commit cac9e245b6
2 changed files with 31 additions and 0 deletions

View File

@@ -366,3 +366,5 @@ erpnext.patches.v13_0.education_deprecation_warning
erpnext.patches.v13_0.requeue_recoverable_reposts
erpnext.patches.v13_0.create_accounting_dimensions_in_orders
erpnext.patches.v13_0.set_per_billed_in_return_delivery_note
erpnext.patches.v13_0.update_employee_advance_status

View File

@@ -0,0 +1,29 @@
import frappe
def execute():
frappe.reload_doc("hr", "doctype", "employee_advance")
advance = frappe.qb.DocType("Employee Advance")
(
frappe.qb.update(advance)
.set(advance.status, "Returned")
.where(
(advance.docstatus == 1)
& ((advance.return_amount) & (advance.paid_amount == advance.return_amount))
& (advance.status == "Paid")
)
).run()
(
frappe.qb.update(advance)
.set(advance.status, "Partly Claimed and Returned")
.where(
(advance.docstatus == 1)
& (
(advance.claimed_amount & advance.return_amount)
& (advance.paid_amount == (advance.return_amount + advance.claimed_amount))
)
& (advance.status == "Paid")
)
).run()