brotherton-erpnext/erpnext/patches/v14_0/update_employee_advance_status.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 lines
666 B
Python
Raw Normal View History

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()