patch: Employee Advance return statuses
This commit is contained in:
parent
e04b3aaf7a
commit
bf30932de0
@ -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
|
26
erpnext/patches/v14_0/update_employee_advance_status.py
Normal file
26
erpnext/patches/v14_0/update_employee_advance_status.py
Normal 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()
|
Loading…
x
Reference in New Issue
Block a user