patch: Employee Advance return statuses

This commit is contained in:
Rucha Mahabal 2022-01-18 14:36:38 +05:30
parent e04b3aaf7a
commit bf30932de0
2 changed files with 28 additions and 1 deletions

View File

@ -326,4 +326,5 @@ erpnext.patches.v13_0.agriculture_deprecation_warning
erpnext.patches.v14_0.delete_agriculture_doctypes
erpnext.patches.v13_0.update_exchange_rate_settings
erpnext.patches.v14_0.rearrange_company_fields
erpnext.patches.v14_0.update_leave_notification_template
erpnext.patches.v14_0.update_leave_notification_template
erpnext.patches.v14_0.update_employee_advance_status

View File

@ -0,0 +1,26 @@
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()