[fix] [minor] don't show cancelled sales orders
This commit is contained in:
parent
0aadb9e213
commit
1ee5ae1e25
@ -111,14 +111,14 @@ class SalesOrder(SellingController):
|
|||||||
|
|
||||||
def validate_warehouse(self):
|
def validate_warehouse(self):
|
||||||
super(SalesOrder, self).validate_warehouse()
|
super(SalesOrder, self).validate_warehouse()
|
||||||
|
|
||||||
for d in self.get("items"):
|
for d in self.get("items"):
|
||||||
if (frappe.db.get_value("Item", d.item_code, "is_stock_item")==1 or
|
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))) \
|
(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):
|
and not d.warehouse and not cint(d.delivered_by_supplier):
|
||||||
frappe.throw(_("Delivery warehouse required for stock item {0}").format(d.item_code),
|
frappe.throw(_("Delivery warehouse required for stock item {0}").format(d.item_code),
|
||||||
WarehouseRequired)
|
WarehouseRequired)
|
||||||
|
|
||||||
def validate_with_previous_doc(self):
|
def validate_with_previous_doc(self):
|
||||||
super(SalesOrder, self).validate_with_previous_doc({
|
super(SalesOrder, self).validate_with_previous_doc({
|
||||||
"Quotation": {
|
"Quotation": {
|
||||||
@ -285,8 +285,8 @@ class SalesOrder(SellingController):
|
|||||||
|
|
||||||
delivered_qty += item.delivered_qty
|
delivered_qty += item.delivered_qty
|
||||||
tot_qty += item.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)
|
update_modified=False)
|
||||||
|
|
||||||
def get_list_context(context=None):
|
def get_list_context(context=None):
|
||||||
@ -518,7 +518,9 @@ def get_events(start, end, filters=None):
|
|||||||
data = frappe.db.sql("""select name, customer_name, delivery_status, billing_status, delivery_date
|
data = frappe.db.sql("""select name, customer_name, delivery_status, billing_status, delivery_date
|
||||||
from `tabSales Order`
|
from `tabSales Order`
|
||||||
where (ifnull(delivery_date, '0000-00-00')!= '0000-00-00') \
|
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), {
|
""".format(conditions=conditions), {
|
||||||
"start": start,
|
"start": start,
|
||||||
"end": end
|
"end": end
|
||||||
@ -533,7 +535,7 @@ def make_purchase_order_for_drop_shipment(source_name, for_supplier, target_doc=
|
|||||||
default_price_list = frappe.get_value("Supplier", for_supplier, "default_price_list")
|
default_price_list = frappe.get_value("Supplier", for_supplier, "default_price_list")
|
||||||
if default_price_list:
|
if default_price_list:
|
||||||
target.buying_price_list = default_price_list
|
target.buying_price_list = default_price_list
|
||||||
|
|
||||||
if any( item.delivered_by_supplier==1 for item in source.items):
|
if any( item.delivered_by_supplier==1 for item in source.items):
|
||||||
if source.shipping_address_name:
|
if source.shipping_address_name:
|
||||||
target.customer_address = source.shipping_address_name
|
target.customer_address = source.shipping_address_name
|
||||||
@ -541,12 +543,12 @@ def make_purchase_order_for_drop_shipment(source_name, for_supplier, target_doc=
|
|||||||
else:
|
else:
|
||||||
target.customer_address = source.customer_address
|
target.customer_address = source.customer_address
|
||||||
target.customer_address_display = source.address_display
|
target.customer_address_display = source.address_display
|
||||||
|
|
||||||
target.customer_contact_person = source.contact_person
|
target.customer_contact_person = source.contact_person
|
||||||
target.customer_contact_display = source.contact_display
|
target.customer_contact_display = source.contact_display
|
||||||
target.customer_contact_mobile = source.contact_mobile
|
target.customer_contact_mobile = source.contact_mobile
|
||||||
target.customer_contact_email = source.contact_email
|
target.customer_contact_email = source.contact_email
|
||||||
|
|
||||||
else:
|
else:
|
||||||
target.customer = ""
|
target.customer = ""
|
||||||
target.customer_name = ""
|
target.customer_name = ""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user