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

@ -2787,7 +2787,7 @@
"label": "Status", "label": "Status",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
"options": "\nDraft\nSubmitted\nPaid\nUnpaid\nOverdue\nCancelled", "options": "\nDraft\nReturn\nDebit Note Issued\nSubmitted\nPaid\nUnpaid\nOverdue\nCancelled",
"permlevel": 0, "permlevel": 0,
"precision": "", "precision": "",
"print_hide": 0, "print_hide": 0,
@ -3293,7 +3293,7 @@
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"menu_index": 0, "menu_index": 0,
"modified": "2016-11-08 11:49:00.752417", "modified": "2016-11-09 14:18:47.094777",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Purchase Invoice", "name": "Purchase Invoice",

View File

@ -14,7 +14,9 @@ frappe.listview_settings['Purchase Invoice'] = {
} else { } else {
return [__("Unpaid"), "orange", "outstanding_amount,>,0|due,>=,Today"]; return [__("Unpaid"), "orange", "outstanding_amount,>,0|due,>=,Today"];
} }
} else if(flt(doc.outstanding_amount)==0 && doc.docstatus==1) { } else if(flt(doc.outstanding_amount) < 0 && doc.docstatus == 1) {
return [__("Debit Note Issued"), "darkgrey", "outstanding_amount,<,0"]
}else if(flt(doc.outstanding_amount)==0 && doc.docstatus==1) {
return [__("Paid"), "green", "outstanding_amount,=,0"]; return [__("Paid"), "green", "outstanding_amount,=,0"];
} }
} }

View File

@ -3081,7 +3081,7 @@
"label": "Status", "label": "Status",
"length": 0, "length": 0,
"no_copy": 1, "no_copy": 1,
"options": "\nDraft\nSubmitted\nPaid\nUnpaid\nOverdue\nCancelled", "options": "\nDraft\nReturn\nCredit Note Issued\nSubmitted\nPaid\nUnpaid\nOverdue\nCancelled",
"permlevel": 0, "permlevel": 0,
"precision": "", "precision": "",
"print_hide": 1, "print_hide": 1,
@ -4039,7 +4039,7 @@
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"menu_index": 0, "menu_index": 0,
"modified": "2016-11-08 11:47:43.494612", "modified": "2016-11-09 14:18:24.760263",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Sales Invoice", "name": "Sales Invoice",

View File

@ -10,7 +10,9 @@ frappe.listview_settings['Sales Invoice'] = {
return [__("Return"), "darkgrey", "is_return,=,Yes"]; return [__("Return"), "darkgrey", "is_return,=,Yes"];
} else if(flt(doc.outstanding_amount)==0) { } else if(flt(doc.outstanding_amount)==0) {
return [__("Paid"), "green", "outstanding_amount,=,0"] return [__("Paid"), "green", "outstanding_amount,=,0"]
} else if (flt(doc.outstanding_amount) > 0 && doc.due_date >= frappe.datetime.get_today()) { } else if(flt(doc.outstanding_amount) < 0) {
return [__("Credit Note Issued"), "darkgrey", "outstanding_amount,<,0"]
}else if (flt(doc.outstanding_amount) > 0 && doc.due_date >= frappe.datetime.get_today()) {
return [__("Unpaid"), "orange", "outstanding_amount,>,0|due_date,>,Today"] return [__("Unpaid"), "orange", "outstanding_amount,>,0|due_date,>,Today"]
} else if (flt(doc.outstanding_amount) > 0 && doc.due_date < frappe.datetime.get_today()) { } else if (flt(doc.outstanding_amount) > 0 && doc.due_date < frappe.datetime.get_today()) {
return [__("Overdue"), "red", "outstanding_amount,>,0|due_date,<=,Today"] return [__("Overdue"), "red", "outstanding_amount,>,0|due_date,<=,Today"]

View File

@ -44,7 +44,9 @@ status_map = {
"Sales Invoice": [ "Sales Invoice": [
["Draft", None], ["Draft", None],
["Submitted", "eval:self.docstatus==1"], ["Submitted", "eval:self.docstatus==1"],
["Paid", "eval:self.outstanding_amount==0 and self.docstatus==1"], ["Return", "eval:self.is_return==1 and self.docstatus==1"],
["Credit Note Issued", "eval:self.outstanding_amount < 0 and self.docstatus==1"],
["Paid", "eval:self.outstanding_amount==0 and self.docstatus==1 and self.is_return==0"],
["Unpaid", "eval:self.outstanding_amount > 0 and getdate(self.due_date) >= getdate(nowdate()) and self.docstatus==1"], ["Unpaid", "eval:self.outstanding_amount > 0 and getdate(self.due_date) >= getdate(nowdate()) and self.docstatus==1"],
["Overdue", "eval:self.outstanding_amount > 0 and getdate(self.due_date) < getdate(nowdate()) and self.docstatus==1"], ["Overdue", "eval:self.outstanding_amount > 0 and getdate(self.due_date) < getdate(nowdate()) and self.docstatus==1"],
["Cancelled", "eval:self.docstatus==2"], ["Cancelled", "eval:self.docstatus==2"],
@ -52,7 +54,9 @@ status_map = {
"Purchase Invoice": [ "Purchase Invoice": [
["Draft", None], ["Draft", None],
["Submitted", "eval:self.docstatus==1"], ["Submitted", "eval:self.docstatus==1"],
["Paid", "eval:self.outstanding_amount==0 and self.docstatus==1"], ["Return", "eval:self.is_return==1 and self.docstatus==1"],
["Debit Note Issued", "eval:self.outstanding_amount < 0 and self.docstatus==1"],
["Paid", "eval:self.outstanding_amount==0 and self.docstatus==1 and self.is_return==0"],
["Unpaid", "eval:self.outstanding_amount > 0 and getdate(self.due_date) >= getdate(nowdate()) and self.docstatus==1"], ["Unpaid", "eval:self.outstanding_amount > 0 and getdate(self.due_date) >= getdate(nowdate()) and self.docstatus==1"],
["Overdue", "eval:self.outstanding_amount > 0 and getdate(self.due_date) < getdate(nowdate()) and self.docstatus==1"], ["Overdue", "eval:self.outstanding_amount > 0 and getdate(self.due_date) < getdate(nowdate()) and self.docstatus==1"],
["Cancelled", "eval:self.docstatus==2"], ["Cancelled", "eval:self.docstatus==2"],

View File

@ -12,9 +12,11 @@ def execute():
update update
`tabPurchase Invoice` `tabPurchase Invoice`
set 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 'Overdue'
when due_date >= CURDATE() and outstanding_amount > 0 and docstatus =1 then 'Unpaid' 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' when docstatus = 2 then 'Cancelled'
else 'Draft' else 'Draft'
End)""") End)""")
@ -22,9 +24,11 @@ def execute():
frappe.db.sql(""" frappe.db.sql("""
update update
`tabSales Invoice` `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 'Overdue'
when due_date >= CURDATE() and outstanding_amount > 0 and docstatus =1 then 'Unpaid' 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' when docstatus = 2 then 'Cancelled'
else 'Draft' else 'Draft'
End)""") End)""")