[fix] [minor] don't show cancelled sales orders
diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py
index 6ec82a2..99e708d 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.py
+++ b/erpnext/selling/doctype/sales_order/sales_order.py
@@ -111,14 +111,14 @@
def validate_warehouse(self):
super(SalesOrder, self).validate_warehouse()
-
+
for d in self.get("items"):
if (frappe.db.get_value("Item", d.item_code, "is_stock_item")==1 or
(self.has_product_bundle(d.item_code) and self.product_bundle_has_stock_item(d.item_code))) \
and not d.warehouse and not cint(d.delivered_by_supplier):
frappe.throw(_("Delivery warehouse required for stock item {0}").format(d.item_code),
WarehouseRequired)
-
+
def validate_with_previous_doc(self):
super(SalesOrder, self).validate_with_previous_doc({
"Quotation": {
@@ -285,8 +285,8 @@
delivered_qty += item.delivered_qty
tot_qty += item.qty
-
- frappe.db.set_value("Sales Order", self.name, "per_delivered", flt(delivered_qty/tot_qty) * 100,
+
+ frappe.db.set_value("Sales Order", self.name, "per_delivered", flt(delivered_qty/tot_qty) * 100,
update_modified=False)
def get_list_context(context=None):
@@ -518,7 +518,9 @@
data = frappe.db.sql("""select name, customer_name, delivery_status, billing_status, delivery_date
from `tabSales Order`
where (ifnull(delivery_date, '0000-00-00')!= '0000-00-00') \
- and (delivery_date between %(start)s and %(end)s) {conditions}
+ and (delivery_date between %(start)s and %(end)s)
+ and docstatus < 2
+ {conditions}
""".format(conditions=conditions), {
"start": start,
"end": end
@@ -533,7 +535,7 @@
default_price_list = frappe.get_value("Supplier", for_supplier, "default_price_list")
if default_price_list:
target.buying_price_list = default_price_list
-
+
if any( item.delivered_by_supplier==1 for item in source.items):
if source.shipping_address_name:
target.customer_address = source.shipping_address_name
@@ -541,12 +543,12 @@
else:
target.customer_address = source.customer_address
target.customer_address_display = source.address_display
-
+
target.customer_contact_person = source.contact_person
target.customer_contact_display = source.contact_display
target.customer_contact_mobile = source.contact_mobile
target.customer_contact_email = source.contact_email
-
+
else:
target.customer = ""
target.customer_name = ""