Skip to content

Commit

Permalink
fix: consider Discounted status
Browse files Browse the repository at this point in the history
  • Loading branch information
pruthvi145 committed Dec 20, 2021
1 parent 6c96ed4 commit 0799f37
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions erpnext/controllers/accounts_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -1729,8 +1729,8 @@ def update_invoice_status():
(invoice.docstatus == 1)
& (invoice.outstanding_amount > 0)
& (
invoice.status.like('Unpaid%')
| invoice.status.like('Partly Paid%')
invoice.status.like("Unpaid%")
| invoice.status.like("Partly Paid%")
)
& (
(invoice.is_pos & invoice.due_date < today) | is_overdue
Expand All @@ -1739,7 +1739,13 @@ def update_invoice_status():
)
)

frappe.qb.update(invoice).set("status", "Overdue").where(conditions).run()
status = (
frappe.qb.terms.Case()
.when(invoice.status.like("%Discounted"), "Overdue and Discounted")
.else_("Overdue")
)

frappe.qb.update(invoice).set("status", status).where(conditions).run()


@frappe.whitelist()
Expand Down

0 comments on commit 0799f37

Please sign in to comment.