| ';
diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js
index 14f1843abe..e18b3ef4e0 100644
--- a/erpnext/buying/doctype/purchase_common/purchase_common.js
+++ b/erpnext/buying/doctype/purchase_common/purchase_common.js
@@ -78,7 +78,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
},
price_list_rate: function(doc, cdt, cdn) {
- var item = frappe.model.get_doc(cdt, cdn);
+ var item = frappe.get_doc(cdt, cdn);
frappe.model.round_floats_in(item, ["price_list_rate", "discount_percentage"]);
item.rate = flt(item.price_list_rate * (1 - item.discount_percentage / 100.0),
@@ -92,7 +92,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
},
rate: function(doc, cdt, cdn) {
- var item = frappe.model.get_doc(cdt, cdn);
+ var item = frappe.get_doc(cdt, cdn);
frappe.model.round_floats_in(item, ["rate", "discount_percentage"]);
if(item.price_list_rate) {
@@ -107,7 +107,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
uom: function(doc, cdt, cdn) {
var me = this;
- var item = frappe.model.get_doc(cdt, cdn);
+ var item = frappe.get_doc(cdt, cdn);
if(item.item_code && item.uom) {
return this.frm.call({
method: "erpnext.buying.utils.get_conversion_factor",
@@ -132,7 +132,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
conversion_factor: function(doc, cdt, cdn) {
if(frappe.meta.get_docfield(cdt, "stock_qty", cdn)) {
- var item = frappe.model.get_doc(cdt, cdn);
+ var item = frappe.get_doc(cdt, cdn);
frappe.model.round_floats_in(item, ["qty", "conversion_factor"]);
item.stock_qty = flt(item.qty * item.conversion_factor, precision("stock_qty", item));
refresh_field("stock_qty", item.name, item.parentfield);
@@ -140,7 +140,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
},
warehouse: function(doc, cdt, cdn) {
- var item = frappe.model.get_doc(cdt, cdn);
+ var item = frappe.get_doc(cdt, cdn);
if(item.item_code && item.warehouse) {
return this.frm.call({
method: "erpnext.buying.utils.get_projected_qty",
@@ -154,7 +154,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
},
project_name: function(doc, cdt, cdn) {
- var item = frappe.model.get_doc(cdt, cdn);
+ var item = frappe.get_doc(cdt, cdn);
if(item.project_name) {
$.each(this.frm.doc[this.fname],
function(i, other_item) {
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js
index 410deeb07d..1dfb78e00d 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.js
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.js
@@ -170,7 +170,7 @@ cur_frm.pformat.indent_no = function(doc, cdt, cdn){
out ='';
- var cl = getchildren('Purchase Order Item',doc.name,'po_details');
+ var cl = doc.po_details || [];
// outer table
var out=' | ';
diff --git a/erpnext/buying/doctype/supplier/supplier.js b/erpnext/buying/doctype/supplier/supplier.js
index cfe526fc58..05288c3882 100644
--- a/erpnext/buying/doctype/supplier/supplier.js
+++ b/erpnext/buying/doctype/supplier/supplier.js
@@ -17,7 +17,7 @@ cur_frm.cscript.refresh = function(doc, dt, dn) {
cur_frm.cscript.make_contact(doc,dt,dn);
cur_frm.communication_view = new frappe.views.CommunicationList({
- list: frappe.model.get("Communication", {"supplier": doc.name}),
+ list: frappe.get_list("Communication", {"supplier": doc.name}),
parent: cur_frm.fields_dict.communication_html.wrapper,
doc: doc
})
diff --git a/erpnext/controllers/js/contact_address_common.js b/erpnext/controllers/js/contact_address_common.js
index 6a66469d63..d06f6a0265 100644
--- a/erpnext/controllers/js/contact_address_common.js
+++ b/erpnext/controllers/js/contact_address_common.js
@@ -23,7 +23,7 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
"Installation Note", "Opportunity", "Customer Issue", "Maintenance Visit",
"Maintenance Schedule"]
.indexOf(doctype)!==-1) {
- var refdoc = frappe.model.get_doc(doctype, docname);
+ var refdoc = frappe.get_doc(doctype, docname);
if(refdoc.doctype == "Quotation" ? refdoc.quotation_to=="Customer" : true) {
cur_frm.set_value("customer", refdoc.customer || refdoc.name);
@@ -34,7 +34,7 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
}
if(["Supplier", "Supplier Quotation", "Purchase Order", "Purchase Invoice", "Purchase Receipt"]
.indexOf(doctype)!==-1) {
- var refdoc = frappe.model.get_doc(doctype, docname);
+ var refdoc = frappe.get_doc(doctype, docname);
cur_frm.set_value("supplier", refdoc.supplier || refdoc.name);
cur_frm.set_value("supplier_name", refdoc.supplier_name);
if(cur_frm.doc.doctype==="Address")
@@ -42,7 +42,7 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
}
if(["Lead", "Quotation"]
.indexOf(doctype)!==-1) {
- var refdoc = frappe.model.get_doc(doctype, docname);
+ var refdoc = frappe.get_doc(doctype, docname);
if(refdoc.doctype == "Quotation" ? refdoc.quotation_to=="Lead" : true) {
cur_frm.set_value("lead", refdoc.lead || refdoc.name);
diff --git a/erpnext/hr/doctype/appraisal/appraisal.js b/erpnext/hr/doctype/appraisal/appraisal.js
index 5bcb96d82c..a87607c03f 100644
--- a/erpnext/hr/doctype/appraisal/appraisal.js
+++ b/erpnext/hr/doctype/appraisal/appraisal.js
@@ -32,7 +32,7 @@ cur_frm.cscript.kra_template = function(doc, dt, dn) {
cur_frm.cscript.calculate_total_score = function(doc,cdt,cdn){
//return get_server_fields('calculate_total','','',doc,cdt,cdn,1);
- var val = getchildren('Appraisal Goal', doc.name, 'appraisal_details', doc.doctype);
+ var val = doc.appraisal_details || [];
var total =0;
for(var i = 0; i item.received_qty) {
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js
index 535fcb735b..6ee3922327 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.js
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.js
@@ -105,9 +105,9 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
},
callback: function(r) {
if (!r.exc) {
- for(d in getchildren('Stock Entry Detail', me.frm.doc.name, 'mtn_details')) {
+ $.each(doc.mtn_details || [], function(i, d) {
if(!d.expense_account) d.expense_account = r.message;
- }
+ });
}
}
});
@@ -225,7 +225,7 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
},
mtn_details_add: function(doc, cdt, cdn) {
- var row = frappe.model.get_doc(cdt, cdn);
+ var row = frappe.get_doc(cdt, cdn);
this.frm.script_manager.copy_from_first_row("mtn_details", row,
["expense_account", "cost_center"]);
@@ -388,7 +388,7 @@ cur_frm.cscript.validate = function(doc, cdt, cdn) {
}
cur_frm.cscript.validate_items = function(doc) {
- cl = getchildren('Stock Entry Detail', doc.name, 'mtn_details');
+ cl = doc.mtn_details || [];
if (!cl.length) {
msgprint(frappe._("Item table can not be blank"));
validated = false;
diff --git a/erpnext/support/doctype/support_ticket/support_ticket.js b/erpnext/support/doctype/support_ticket/support_ticket.js
index 034fa8694f..c18653549c 100644
--- a/erpnext/support/doctype/support_ticket/support_ticket.js
+++ b/erpnext/support/doctype/support_ticket/support_ticket.js
@@ -34,7 +34,7 @@ $.extend(cur_frm.cscript, {
make_listing: function(doc) {
var wrapper = cur_frm.fields_dict['thread_html'].wrapper;
- var comm_list = frappe.model.get("Communication", {"parent": doc.name, "parenttype":"Support Ticket"})
+ var comm_list = frappe.get_list("Communication", {"parent": doc.name, "parenttype":"Support Ticket"})
if(!comm_list.length) {
comm_list.push({
diff --git a/erpnext/utilities/doctype/contact/contact.js b/erpnext/utilities/doctype/contact/contact.js
index eb7681f886..f2a2fdcef2 100644
--- a/erpnext/utilities/doctype/contact/contact.js
+++ b/erpnext/utilities/doctype/contact/contact.js
@@ -5,7 +5,7 @@
cur_frm.cscript.refresh = function(doc) {
cur_frm.communication_view = new frappe.views.CommunicationList({
- list: frappe.model.get("Communication", {"parent": doc.name, "parenttype": "Contact"}),
+ list: frappe.get_list("Communication", {"parent": doc.name, "parenttype": "Contact"}),
parent: cur_frm.fields_dict.communication_html.wrapper,
doc: doc,
recipients: doc.email_id
|
|