[fix] Ignore closed sales order in credit limit validation

This commit is contained in:
Nabin Hait 2016-04-13 15:19:37 +05:30
parent 55f6308169
commit 7132bd3659
2 changed files with 3 additions and 3 deletions

View File

@ -118,7 +118,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
setup_sms: function() { setup_sms: function() {
var me = this; var me = this;
if(this.frm.doc.docstatus===1 && !in_list(["Lost", "Stopped"], this.frm.doc.status) if(this.frm.doc.docstatus===1 && !in_list(["Lost", "Stopped", "Closed"], this.frm.doc.status)
&& this.frm.doctype != "Purchase Invoice") { && this.frm.doctype != "Purchase Invoice") {
this.frm.page.add_menu_item(__('Send SMS'), function() { me.send_sms(); }); this.frm.page.add_menu_item(__('Send SMS'), function() { me.send_sms(); });
} }

View File

@ -199,7 +199,7 @@ def get_customer_outstanding(customer, company):
select sum(base_grand_total*(100 - per_billed)/100) select sum(base_grand_total*(100 - per_billed)/100)
from `tabSales Order` from `tabSales Order`
where customer=%s and docstatus = 1 and company=%s where customer=%s and docstatus = 1 and company=%s
and per_billed < 100 and status != 'Stopped'""", (customer, company)) and per_billed < 100 and status != 'Closed'""", (customer, company))
outstanding_based_on_so = flt(outstanding_based_on_so[0][0]) if outstanding_based_on_so else 0.0 outstanding_based_on_so = flt(outstanding_based_on_so[0][0]) if outstanding_based_on_so else 0.0
@ -210,7 +210,7 @@ def get_customer_outstanding(customer, company):
where where
dn.name = dn_item.parent dn.name = dn_item.parent
and dn.customer=%s and dn.company=%s and dn.customer=%s and dn.company=%s
and dn.docstatus = 1 and dn.status != 'Stopped' and dn.docstatus = 1 and dn.status not in ('Closed', 'Stopped')
and ifnull(dn_item.against_sales_order, '') = '' and ifnull(dn_item.against_sales_order, '') = ''
and ifnull(dn_item.against_sales_invoice, '') = ''""", (customer, company), as_dict=True) and ifnull(dn_item.against_sales_invoice, '') = ''""", (customer, company), as_dict=True)