patch: Employee Advance return statuses
This commit is contained in:
@@ -366,3 +366,5 @@ erpnext.patches.v13_0.education_deprecation_warning
|
|||||||
erpnext.patches.v13_0.requeue_recoverable_reposts
|
erpnext.patches.v13_0.requeue_recoverable_reposts
|
||||||
erpnext.patches.v13_0.create_accounting_dimensions_in_orders
|
erpnext.patches.v13_0.create_accounting_dimensions_in_orders
|
||||||
erpnext.patches.v13_0.set_per_billed_in_return_delivery_note
|
erpnext.patches.v13_0.set_per_billed_in_return_delivery_note
|
||||||
|
erpnext.patches.v13_0.update_employee_advance_status
|
||||||
|
|
||||||
|
|||||||
29
erpnext/patches/v13_0/update_employee_advance_status.py
Normal file
29
erpnext/patches/v13_0/update_employee_advance_status.py
Normal 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()
|
||||||
Reference in New Issue
Block a user