added debit and credit note status

This commit is contained in:
Rohit Waghchaure
2016-11-09 14:16:58 +05:30
parent 2f1db57fe1
commit 2285f90b64
6 changed files with 22 additions and 10 deletions

View File

@@ -12,9 +12,11 @@ def execute():
update
`tabPurchase Invoice`
set
status = (Case When outstanding_amount = 0 and docstatus = 1 then 'Paid'
status = (Case When outstanding_amount = 0 and docstatus = 1 and is_return = 0 then 'Paid'
when due_date < CURDATE() and outstanding_amount > 0 and docstatus =1 then 'Overdue'
when due_date >= CURDATE() and outstanding_amount > 0 and docstatus =1 then 'Unpaid'
when outstanding_amount < 0 and docstatus =1 then 'Debit Note Issued'
when is_return = 1 and docstatus =1 then 'Return'
when docstatus = 2 then 'Cancelled'
else 'Draft'
End)""")
@@ -22,9 +24,11 @@ def execute():
frappe.db.sql("""
update
`tabSales Invoice`
set status = (Case When outstanding_amount = 0 and docstatus = 1 then 'Paid'
set status = (Case When outstanding_amount = 0 and docstatus = 1 and is_return = 0 then 'Paid'
when due_date < CURDATE() and outstanding_amount > 0 and docstatus =1 then 'Overdue'
when due_date >= CURDATE() and outstanding_amount > 0 and docstatus =1 then 'Unpaid'
when outstanding_amount < 0 and docstatus =1 then 'Credit Note Issued'
when is_return = 1 and docstatus =1 then 'Return'
when docstatus = 2 then 'Cancelled'
else 'Draft'
End)""")