[fixes] reload doc after status update and supplier address fetching
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js
index b6a785c..146694e 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.js
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.js
@@ -179,7 +179,9 @@
purchase_order: cur_frm.doc.name
},
callback:function(r){
- cur_frm.refresh();
+ if(!r.exc) {
+ cur_frm.reload_doc();
+ }
}
})
}
@@ -198,7 +200,8 @@
method: "erpnext.buying.doctype.purchase_order.purchase_order.update_status",
args:{status: status, name: doc.name},
callback:function(r){
- cur_frm.refresh();
+ cur_frm.set_value("status", status);
+ cur_frm.reload_doc();
}
})
}
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py
index 3fe833f..26837f1 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.py
@@ -344,14 +344,12 @@
def update_status(status, name):
po = frappe.get_doc("Purchase Order", name)
po.update_status(status)
- return
@frappe.whitelist()
def delivered_by_supplier(purchase_order):
po = frappe.get_doc("Purchase Order", purchase_order)
update_delivered_qty(po)
po.update_status("Delivered")
- return po.as_dict()
def update_delivered_qty(purchase_order):
sales_order_list = []
diff --git a/erpnext/public/js/utils/party.js b/erpnext/public/js/utils/party.js
index 510938a..93301fc 100644
--- a/erpnext/public/js/utils/party.js
+++ b/erpnext/public/js/utils/party.js
@@ -53,7 +53,7 @@
if(frm.updating_party_details) return;
if(!address_field) {
- if(frm.doc.customer) {
+ if(frm.doctype != "Purchase Order" && frm.doc.customer) {
address_field = "customer_address";
} else if(frm.doc.supplier) {
address_field = "supplier_address";
diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js
index af300f6..9ad6d56 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.js
+++ b/erpnext/selling/doctype/sales_order/sales_order.js
@@ -37,7 +37,7 @@
// doc.per_billed);
// indent
- if(!doc.order_type || ["Sales", "Shopping Cart"].indexOf(doc.order_type)!==-1)
+ if(!doc.order_type || ["Sales", "Shopping Cart"].indexOf(doc.order_type)!==-1 && flt(doc.per_delivered, 2) < 100)
cur_frm.add_custom_button(__('Material Request'), this.make_material_request);
if(flt(doc.per_billed)==0) {
@@ -241,7 +241,7 @@
method: "erpnext.selling.doctype.sales_order.sales_order.update_status",
args:{status: status, name: doc.name},
callback:function(r){
- cur_frm.refresh();
+ cur_frm.reload_doc();
}
})
}