refactored client side Model and Meta - frappe/frappe#478
diff --git a/erpnext/accounts/doctype/account/account.js b/erpnext/accounts/doctype/account/account.js
index 2577ccf..f4f2b8a 100644
--- a/erpnext/accounts/doctype/account/account.js
+++ b/erpnext/accounts/doctype/account/account.js
@@ -87,7 +87,7 @@
}
cur_frm.cscript.convert_to_ledger = function(doc, cdt, cdn) {
- return $c_obj(cur_frm.get_doclist(),'convert_group_to_ledger','',function(r,rt) {
+ return $c_obj(cur_frm.doc,'convert_group_to_ledger','',function(r,rt) {
if(r.message == 1) {
cur_frm.refresh();
}
@@ -95,7 +95,7 @@
}
cur_frm.cscript.convert_to_group = function(doc, cdt, cdn) {
- return $c_obj(cur_frm.get_doclist(),'convert_ledger_to_group','',function(r,rt) {
+ return $c_obj(cur_frm.doc,'convert_ledger_to_group','',function(r,rt) {
if(r.message == 1) {
cur_frm.refresh();
}
diff --git a/erpnext/accounts/doctype/budget_distribution/budget_distribution.js b/erpnext/accounts/doctype/budget_distribution/budget_distribution.js
index c256374..3c11d87 100644
--- a/erpnext/accounts/doctype/budget_distribution/budget_distribution.js
+++ b/erpnext/accounts/doctype/budget_distribution/budget_distribution.js
@@ -7,8 +7,7 @@
refresh_field('budget_distribution_details');
}
- return $c('runserverobj',args={'method' : 'get_months', 'docs' :
- frappe.model.compress(make_doclist(doc.doctype, doc.name))},callback1);
+ return $c('runserverobj',args={'method':'get_months', 'docs':doc}, callback1);
}
}
diff --git a/erpnext/accounts/doctype/cost_center/cost_center.js b/erpnext/accounts/doctype/cost_center/cost_center.js
index 5c8be10..0cd3a70 100644
--- a/erpnext/accounts/doctype/cost_center/cost_center.js
+++ b/erpnext/accounts/doctype/cost_center/cost_center.js
@@ -70,7 +70,7 @@
}
cur_frm.cscript.convert_to_ledger = function(doc, cdt, cdn) {
- return $c_obj(cur_frm.get_doclist(),'convert_group_to_ledger','',function(r,rt) {
+ return $c_obj(cur_frm.doc,'convert_group_to_ledger','',function(r,rt) {
if(r.message == 1) {
cur_frm.refresh();
}
@@ -78,7 +78,7 @@
}
cur_frm.cscript.convert_to_group = function(doc, cdt, cdn) {
- return $c_obj(cur_frm.get_doclist(),'convert_ledger_to_group','',function(r,rt) {
+ return $c_obj(cur_frm.doc,'convert_ledger_to_group','',function(r,rt) {
if(r.message == 1) {
cur_frm.refresh();
}
diff --git a/erpnext/accounts/doctype/journal_voucher/journal_voucher.js b/erpnext/accounts/doctype/journal_voucher/journal_voucher.js
index 1107ba4..fc042ba 100644
--- a/erpnext/accounts/doctype/journal_voucher/journal_voucher.js
+++ b/erpnext/accounts/doctype/journal_voucher/journal_voucher.js
@@ -12,8 +12,7 @@
load_defaults: function() {
if(this.frm.doc.__islocal && this.frm.doc.company) {
frappe.model.set_default_values(this.frm.doc);
- $.each(frappe.model.get_doclist(this.frm.doc.doctype,
- this.frm.doc.name, {parentfield: "entries"}), function(i, jvd) {
+ $.each(this.frm.doc.entries, function(i, jvd) {
frappe.model.set_default_values(jvd);
}
);
@@ -156,7 +155,7 @@
cur_frm.cscript.get_balance = function(doc,dt,dn) {
cur_frm.cscript.update_totals(doc);
- return $c_obj(make_doclist(dt,dn), 'get_balance', '', function(r, rt){
+ return $c_obj(cur_frm.doc, 'get_balance', '', function(r, rt){
cur_frm.refresh();
});
}
@@ -194,8 +193,7 @@
cur_frm.set_df_property("cheque_no", "reqd", doc.voucher_type=="Bank Voucher");
cur_frm.set_df_property("cheque_date", "reqd", doc.voucher_type=="Bank Voucher");
- if(frappe.model.get("Journal Voucher Detail", {"parent":doc.name}).length!==0 // too late
- || !doc.company) // too early
+ if((doc.entries || []).length!==0 || !doc.company) // too early
return;
var update_jv_details = function(doc, r) {
diff --git a/erpnext/accounts/doctype/pos_setting/pos_setting.js b/erpnext/accounts/doctype/pos_setting/pos_setting.js
index debfcd9..61c64c2 100755
--- a/erpnext/accounts/doctype/pos_setting/pos_setting.js
+++ b/erpnext/accounts/doctype/pos_setting/pos_setting.js
@@ -2,7 +2,7 @@
// License: GNU General Public License v3. See license.txt
cur_frm.cscript.onload = function(doc,cdt,cdn){
- return $c_obj(make_doclist(cdt,cdn),'get_series','',function(r,rt){
+ return $c_obj(cur_frm.doc, 'get_series','',function(r,rt){
if(r.message) set_field_options('naming_series', r.message);
});
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index 42cf823..ebde867 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -68,7 +68,7 @@
if(cint(doc.update_stock)!=1) {
// show Make Delivery Note button only if Sales Invoice is not created from Delivery Note
var from_delivery_note = false;
- from_delivery_note = cur_frm.get_doclist({parentfield: "entries"})
+ from_delivery_note = cur_frm.doc.entries
.some(function(item) {
return item.delivery_note ? true : false;
});
diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js
index 6afcd95..14f1843 100644
--- a/erpnext/buying/doctype/purchase_common/purchase_common.js
+++ b/erpnext/buying/doctype/purchase_common/purchase_common.js
@@ -156,7 +156,7 @@
project_name: function(doc, cdt, cdn) {
var item = frappe.model.get_doc(cdt, cdn);
if(item.project_name) {
- $.each(frappe.model.get_doclist(this.frm.doc.doctype, this.frm.doc.name, {parentfield: this.fname}),
+ $.each(this.frm.doc[this.fname],
function(i, other_item) {
if(!other_item.project_name) {
other_item.project_name = item.project_name;
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js
index 0db8d6f..410deeb 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.js
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.js
@@ -128,7 +128,7 @@
}
cur_frm.cscript.get_last_purchase_rate = function(doc, cdt, cdn){
- return $c_obj(make_doclist(doc.doctype, doc.name), 'get_last_purchase_rate', '', function(r, rt) {
+ return $c_obj(doc, 'get_last_purchase_rate', '', function(r, rt) {
refresh_field(cur_frm.cscript.fname);
var doc = locals[cdt][cdn];
cur_frm.cscript.calc_amount( doc, 2);
@@ -140,7 +140,7 @@
var check = confirm(frappe._("Do you really want to STOP ") + doc.name);
if (check) {
- return $c('runserverobj', args={'method':'update_status', 'arg': 'Stopped', 'docs': frappe.model.compress(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
+ return $c('runserverobj', args={'method':'update_status', 'arg': 'Stopped', 'docs':doc}, function(r,rt) {
cur_frm.refresh();
});
}
@@ -151,7 +151,7 @@
var check = confirm(frappe._("Do you really want to UNSTOP ") + doc.name);
if (check) {
- return $c('runserverobj', args={'method':'update_status', 'arg': 'Submitted', 'docs': frappe.model.compress(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
+ return $c('runserverobj', args={'method':'update_status', 'arg': 'Submitted', 'docs':doc}, function(r,rt) {
cur_frm.refresh();
});
}
diff --git a/erpnext/hr/doctype/employee/employee.js b/erpnext/hr/doctype/employee/employee.js
index c27a4c5..88cf7ca 100644
--- a/erpnext/hr/doctype/employee/employee.js
+++ b/erpnext/hr/doctype/employee/employee.js
@@ -68,7 +68,7 @@
Go to the active Salary Structure and set \"Is Active\" = \"No\""));
} else if(!r.exc) {
frappe.model.map({
- source: frappe.model.get_doclist(me.frm.doc.doctype, me.frm.doc.name),
+ source: me.frm.doc,
target: "Salary Structure"
});
}
diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.js b/erpnext/hr/doctype/expense_claim/expense_claim.js
index 6ff1d3f..9c54fd6 100644
--- a/erpnext/hr/doctype/expense_claim/expense_claim.js
+++ b/erpnext/hr/doctype/expense_claim/expense_claim.js
@@ -125,7 +125,7 @@
cur_frm.cscript.calculate_total = function(doc,cdt,cdn){
doc.total_claimed_amount = 0;
doc.total_sanctioned_amount = 0;
- $.each(frappe.model.get("Expense Claim Detail", {parent:doc.name}), function(i, d) {
+ $.each((doc.expense_voucher_details || []), function(i, d) {
doc.total_claimed_amount += d.claim_amount;
if(d.sanctioned_amount==null) {
d.sanctioned_amount = d.claim_amount;
diff --git a/erpnext/hr/doctype/leave_control_panel/leave_control_panel.js b/erpnext/hr/doctype/leave_control_panel/leave_control_panel.js
index be9096c..16ede67 100644
--- a/erpnext/hr/doctype/leave_control_panel/leave_control_panel.js
+++ b/erpnext/hr/doctype/leave_control_panel/leave_control_panel.js
@@ -9,7 +9,7 @@
}
cur_frm.cscript.to_date = function(doc, cdt, cdn) {
- return $c('runserverobj', args={'method':'to_date_validation','docs':frappe.model.compress(make_doclist(doc.doctype, doc.name))},
+ return $c('runserverobj', args={'method':'to_date_validation','docs':doc},
function(r, rt) {
var doc = locals[cdt][cdn];
if (r.message) {
diff --git a/erpnext/hr/doctype/salary_manager/salary_manager.js b/erpnext/hr/doctype/salary_manager/salary_manager.js
index 312a06d..3745ee5 100644
--- a/erpnext/hr/doctype/salary_manager/salary_manager.js
+++ b/erpnext/hr/doctype/salary_manager/salary_manager.js
@@ -15,7 +15,7 @@
if (r.message)
display_activity_log(r.message);
}
- return $c('runserverobj', args={'method':'create_sal_slip','docs':frappe.model.compress(make_doclist (cdt, cdn))},callback);
+ return $c('runserverobj', args={'method':'create_sal_slip','docs':doc},callback);
}
cur_frm.cscript.submit_salary_slip = function(doc, cdt, cdn) {
@@ -25,7 +25,7 @@
if (r.message)
display_activity_log(r.message);
}
- return $c('runserverobj', args={'method':'submit_salary_slip','docs':frappe.model.compress(make_doclist (cdt, cdn))},callback);
+ return $c('runserverobj', args={'method':'submit_salary_slip','docs':doc},callback);
}
}
@@ -59,5 +59,5 @@
loaddoc('Journal Voucher', jv.name);
}
- return $c_obj(make_doclist(dt, dn), 'get_acc_details', '', call_back);
+ return $c_obj(doc, 'get_acc_details', '', call_back);
}
diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.js b/erpnext/hr/doctype/salary_slip/salary_slip.js
index ceab148..e8aa638 100644
--- a/erpnext/hr/doctype/salary_slip/salary_slip.js
+++ b/erpnext/hr/doctype/salary_slip/salary_slip.js
@@ -21,7 +21,7 @@
// Get leave details
//---------------------------------------------------------------------
cur_frm.cscript.fiscal_year = function(doc,dt,dn){
- return $c_obj(make_doclist(doc.doctype,doc.name), 'get_emp_and_leave_details','',function(r, rt) {
+ return $c_obj(doc, 'get_emp_and_leave_details','',function(r, rt) {
var doc = locals[dt][dn];
cur_frm.refresh();
calculate_all(doc, dt, dn);
@@ -32,7 +32,7 @@
cur_frm.cscript.leave_without_pay = function(doc,dt,dn){
if (doc.employee && doc.fiscal_year && doc.month) {
- return $c_obj(make_doclist(doc.doctype,doc.name), 'get_leave_details',doc.leave_without_pay,function(r, rt) {
+ return $c_obj(doc, 'get_leave_details',doc.leave_without_pay,function(r, rt) {
var doc = locals[dt][dn];
cur_frm.refresh();
calculate_all(doc, dt, dn);
diff --git a/erpnext/hr/doctype/salary_structure/salary_structure.js b/erpnext/hr/doctype/salary_structure/salary_structure.js
index 3b90ee6..fc70455 100644
--- a/erpnext/hr/doctype/salary_structure/salary_structure.js
+++ b/erpnext/hr/doctype/salary_structure/salary_structure.js
@@ -7,7 +7,7 @@
e_tbl = getchildren('Salary Structure Earning', doc.name, 'earning_details', doc.doctype);
d_tbl = getchildren('Salary Structure Deduction', doc.name, 'deduction_details', doc.doctype);
if (e_tbl.length == 0 && d_tbl.length == 0)
- return $c_obj(make_doclist(doc.doctype,doc.name),'make_earn_ded_table','', function(r, rt) { refresh_many(['earning_details', 'deduction_details']);});
+ return $c_obj(doc,'make_earn_ded_table','', function(r, rt) { refresh_many(['earning_details', 'deduction_details']);});
}
cur_frm.cscript.refresh = function(doc, dt, dn){
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.js b/erpnext/manufacturing/doctype/production_order/production_order.js
index 86580d6..5901731 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.js
+++ b/erpnext/manufacturing/doctype/production_order/production_order.js
@@ -70,7 +70,7 @@
var doc = cur_frm.doc;
var check = confirm(frappe._("Do you really want to stop production order: " + doc.name));
if (check) {
- return $c_obj(make_doclist(doc.doctype, doc.name), 'stop_unstop', 'Stopped', function(r, rt) {cur_frm.refresh();});
+ return $c_obj(doc, 'stop_unstop', 'Stopped', function(r, rt) {cur_frm.refresh();});
}
}
@@ -78,7 +78,7 @@
var doc = cur_frm.doc;
var check = confirm(frappe._("Do really want to unstop production order: " + doc.name));
if (check)
- return $c_obj(make_doclist(doc.doctype, doc.name), 'stop_unstop', 'Unstopped', function(r, rt) {cur_frm.refresh();});
+ return $c_obj(doc, 'stop_unstop', 'Unstopped', function(r, rt) {cur_frm.refresh();});
}
cur_frm.cscript['Transfer Raw Materials'] = function() {
diff --git a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.js b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.js
index fdd4db1..fc7abde 100644
--- a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.js
+++ b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.js
@@ -25,9 +25,9 @@
}
cur_frm.cscript.download_materials_required = function(doc, cdt, cdn) {
- return $c_obj(make_doclist(cdt, cdn), 'validate_data', '', function(r, rt) {
+ return $c_obj(doc, 'validate_data', '', function(r, rt) {
if (!r['exc'])
- $c_obj_csv(make_doclist(cdt, cdn), 'download_raw_materials', '', '');
+ $c_obj_csv(doc, 'download_raw_materials', '', '');
});
}
diff --git a/erpnext/projects/doctype/time_log_batch/time_log_batch.js b/erpnext/projects/doctype/time_log_batch/time_log_batch.js
index 7aa3e16..7f3a17e 100644
--- a/erpnext/projects/doctype/time_log_batch/time_log_batch.js
+++ b/erpnext/projects/doctype/time_log_batch/time_log_batch.js
@@ -30,9 +30,8 @@
}
},
make_invoice: function() {
- var doc = cur_frm.doc;
frappe.model.map({
- source: frappe.model.get_doclist(doc.doctype, doc.name),
+ source: cur_frm.doc,
target: "Sales Invoice"
});
}
diff --git a/erpnext/public/js/transaction.js b/erpnext/public/js/transaction.js
index 2f89470..22c3c3a 100644
--- a/erpnext/public/js/transaction.js
+++ b/erpnext/public/js/transaction.js
@@ -46,7 +46,6 @@
freeze: true,
callback: function(r) {
// remove this call when using client side mapper
- me.set_default_values();
me.set_dynamic_labels();
me.calculate_taxes_and_totals();
}
@@ -192,18 +191,7 @@
validate: function() {
this.calculate_taxes_and_totals();
},
-
- set_default_values: function() {
- $.each(frappe.model.get_doclist(this.frm.doctype, this.frm.docname), function(i, doc) {
- var updated = frappe.model.set_default_values(doc);
- if(doc.parentfield) {
- refresh_field(doc.parentfield);
- } else {
- refresh_field(updated);
- }
- });
- },
-
+
company: function() {
if(this.frm.doc.company && this.frm.fields_dict.currency) {
var company_currency = this.get_company_currency();
@@ -517,13 +505,11 @@
},
get_item_doclist: function() {
- return frappe.model.get_doclist(this.frm.doc.doctype, this.frm.doc.name,
- {parentfield: this.fname});
+ return this.frm.doc[this.fname] || [];
},
get_tax_doclist: function() {
- return frappe.model.get_doclist(this.frm.doc.doctype, this.frm.doc.name,
- {parentfield: this.other_fname});
+ return this.frm.doc[this.other_fname] || [];
},
validate_conversion_rate: function() {
@@ -716,8 +702,7 @@
calculate_total_advance: function(parenttype, advance_parentfield) {
if(this.frm.doc.doctype == parenttype && this.frm.doc.docstatus < 2) {
- var advance_doclist = frappe.model.get_doclist(this.frm.doc.doctype, this.frm.doc.name,
- {parentfield: advance_parentfield});
+ var advance_doclist = this.frm.doc[advance_parentfield] || [];
this.frm.doc.total_advance = flt(frappe.utils.sum(
$.map(advance_doclist, function(adv) { return adv.allocated_amount })
), precision("total_advance"));
diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js
index c5d3e0b..9f7f278 100644
--- a/erpnext/public/js/utils.js
+++ b/erpnext/public/js/utils.js
@@ -29,8 +29,7 @@
},
add_applicable_territory: function() {
- if(cur_frm.doc.__islocal &&
- frappe.model.get_doclist(cur_frm.doc.doctype, cur_frm.doc.name).length === 1) {
+ if(cur_frm.doc.__islocal && (cur_frm.doc.valid_for_territories || []).length===0) {
var default_territory = frappe.defaults.get_user_default("territory");
if(default_territory) {
var territory = frappe.model.add_child(cur_frm.doc, "Applicable Territory",
diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js
index 0a3ca99..727cca8 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.js
+++ b/erpnext/selling/doctype/sales_order/sales_order.js
@@ -162,7 +162,7 @@
if (check) {
return $c('runserverobj', {
'method':'stop_sales_order',
- 'docs': frappe.model.compress(make_doclist(doc.doctype, doc.name))
+ 'docs': doc
}, function(r,rt) {
cur_frm.refresh();
});
@@ -177,7 +177,7 @@
if (check) {
return $c('runserverobj', {
'method':'unstop_sales_order',
- 'docs': frappe.model.compress(make_doclist(doc.doctype, doc.name))
+ 'docs': doc
}, function(r,rt) {
cur_frm.refresh();
});
diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js
index 1dbbbfe..6859567 100644
--- a/erpnext/selling/sales_common.js
+++ b/erpnext/selling/sales_common.js
@@ -98,7 +98,7 @@
this.frm.toggle_display("customer_name",
(this.frm.doc.customer_name && this.frm.doc.customer_name!==this.frm.doc.customer));
if(this.frm.fields_dict.packing_details) {
- var packing_list_exists = this.frm.get_doclist({parentfield: "packing_details"}).length;
+ var packing_list_exists = (this.frm.doc.packing_details || []).length;
this.frm.toggle_display("packing_list", packing_list_exists ? true : false);
}
},
@@ -434,8 +434,7 @@
calculate_contribution: function() {
var me = this;
- $.each(frappe.model.get_doclist(this.frm.doc.doctype, this.frm.doc.name,
- {parentfield: "sales_team"}), function(i, sales_person) {
+ $.each(this.frm.doc.doctype.sales_team || [], function(i, sales_person) {
frappe.model.round_floats_in(sales_person);
if(sales_person.allocated_percentage) {
sales_person.allocated_amount = flt(
@@ -545,8 +544,8 @@
// toggle columns
var item_grid = this.frm.fields_dict[this.fname].grid;
var show = (this.frm.doc.currency != company_currency) ||
- (frappe.model.get_doclist(cur_frm.doctype, cur_frm.docname,
- {parentfield: "other_charges", included_in_print_rate: 1}).length);
+ (cur_frm.doc.other_charges.filter(
+ function(d) { return d.included_in_print_rate===1}).length);
$.each(["base_rate", "base_price_list_rate", "base_amount"], function(i, fname) {
if(frappe.meta.get_docfield(item_grid.doctype, fname))
diff --git a/erpnext/setup/doctype/contact_control/contact_control.js b/erpnext/setup/doctype/contact_control/contact_control.js
index f28e3a0..743bedd 100755
--- a/erpnext/setup/doctype/contact_control/contact_control.js
+++ b/erpnext/setup/doctype/contact_control/contact_control.js
@@ -2,7 +2,7 @@
// License: GNU General Public License v3. See license.txt
cur_frm.cscript.get_states=function(doc, dt, dn) {
- return $c('runserverobj', args={'method': 'check_state', 'docs':frappe.model.compress(make_doclist(doc.doctype, doc.name))},
+ return $c('runserverobj', args={'method': 'check_state', 'docs':doc},
function(r, rt) {
if(r.message)
set_field_options('state', r.message);
diff --git a/erpnext/setup/doctype/email_digest/email_digest.js b/erpnext/setup/doctype/email_digest/email_digest.js
index 875061b..51f6231 100644
--- a/erpnext/setup/doctype/email_digest/email_digest.js
+++ b/erpnext/setup/doctype/email_digest/email_digest.js
@@ -9,7 +9,7 @@
cur_frm.add_custom_button(frappe._('View Now'), function() {
doc = locals[dt][dn];
if(doc.__unsaved != 1) {
- return $c_obj(make_doclist(dt, dn), 'get_digest_msg', '', function(r, rt) {
+ return $c_obj(doc, 'get_digest_msg', '', function(r, rt) {
if(r.exc) {
msgprint(err_msg);
console.log(r.exc);
@@ -32,7 +32,7 @@
cur_frm.add_custom_button(frappe._('Send Now'), function() {
doc = locals[dt][dn];
if(doc.__unsaved != 1) {
- return $c_obj(make_doclist(dt, dn), 'send', '', function(r, rt) {
+ return $c_obj(doc, 'send', '', function(r, rt) {
if(r.exc) {
msgprint(err_msg);
console.log(r.exc);
@@ -49,7 +49,7 @@
cur_frm.cscript.addremove_recipients = function(doc, dt, dn) {
// Get user list
- return $c_obj(make_doclist(dt, dn), 'get_users', '', function(r, rt) {
+ return $c_obj(doc, 'get_users', '', function(r, rt) {
if(r.exc) {
msgprint(r.exc);
} else {
diff --git a/erpnext/setup/doctype/global_defaults/global_defaults.js b/erpnext/setup/doctype/global_defaults/global_defaults.js
index 4b378b3..85d718a 100644
--- a/erpnext/setup/doctype/global_defaults/global_defaults.js
+++ b/erpnext/setup/doctype/global_defaults/global_defaults.js
@@ -18,7 +18,7 @@
},
validate: function(doc, cdt, cdn) {
- return $c_obj(make_doclist(cdt, cdn), 'get_defaults', '', function(r, rt){
+ return $c_obj(doc, 'get_defaults', '', function(r, rt){
sys_defaults = r.message;
});
},
diff --git a/erpnext/setup/doctype/naming_series/naming_series.js b/erpnext/setup/doctype/naming_series/naming_series.js
index 4f6a4c9..b9b94ca 100644
--- a/erpnext/setup/doctype/naming_series/naming_series.js
+++ b/erpnext/setup/doctype/naming_series/naming_series.js
@@ -29,7 +29,7 @@
}
if(doc.select_doc_for_series)
- return $c_obj(make_doclist(doc.doctype, doc.name),'get_options','',callback);
+ return $c_obj(doc,'get_options','',callback);
}
cur_frm.cscript.update = function() {
diff --git a/erpnext/setup/doctype/notification_control/notification_control.js b/erpnext/setup/doctype/notification_control/notification_control.js
index 9d26496..19660b8 100644
--- a/erpnext/setup/doctype/notification_control/notification_control.js
+++ b/erpnext/setup/doctype/notification_control/notification_control.js
@@ -8,6 +8,6 @@
doc.custom_message = r.message;
refresh_field('custom_message');
}
- return $c_obj(make_doclist(cdt, cdn),'get_message',doc.select_transaction, callback)
+ return $c_obj(doc,'get_message',doc.select_transaction, callback)
}
}
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js
index 371c093..3a9ef8d 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.js
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.js
@@ -20,8 +20,7 @@
if(!doc.__billing_complete && doc.docstatus==1) {
// show Make Invoice button only if Delivery Note is not created from Sales Invoice
var from_sales_invoice = false;
- from_sales_invoice = cur_frm.get_doclist({parentfield: "delivery_note_details"})
- .some(function(item) {
+ from_sales_invoice = cur_frm.doc.delivery_note_details.some(function(item) {
return item.against_sales_invoice ? true : false;
});
diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js
index 3cae599..b797420 100644
--- a/erpnext/stock/doctype/item/item.js
+++ b/erpnext/stock/doctype/item/item.js
@@ -151,8 +151,7 @@
cur_frm.cscript.copy_from_item_group = function(doc) {
frappe.model.with_doc("Item Group", doc.item_group, function() {
- $.each(frappe.model.get("Item Website Specification", {parent:doc.item_group}),
- function(i, d) {
+ $.each((doc.item_website_specifications || []), function(i, d) {
var n = frappe.model.add_child(doc, "Item Website Specification",
"item_website_specifications");
n.label = d.label;
diff --git a/erpnext/stock/doctype/material_request/material_request.js b/erpnext/stock/doctype/material_request/material_request.js
index c830775..081469b 100644
--- a/erpnext/stock/doctype/material_request/material_request.js
+++ b/erpnext/stock/doctype/material_request/material_request.js
@@ -80,7 +80,7 @@
schedule_date: function(doc, cdt, cdn) {
var val = locals[cdt][cdn].schedule_date;
if(val) {
- $.each(frappe.model.get("Material Request Item", { parent: cur_frm.doc.name }), function(i, d) {
+ $.each((doc.indent_details || []), function(i, d) {
if(!d.schedule_date) {
d.schedule_date = val;
}
@@ -172,7 +172,7 @@
var check = confirm(frappe._("Do you really want to STOP this Material Request?"));
if (check) {
- return $c('runserverobj', args={'method':'update_status', 'arg': 'Stopped', 'docs': frappe.model.compress(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
+ return $c('runserverobj', args={'method':'update_status', 'arg': 'Stopped', 'docs': doc}, function(r,rt) {
cur_frm.refresh();
});
}
@@ -183,7 +183,7 @@
var check = confirm(frappe._("Do you really want to UNSTOP this Material Request?"));
if (check) {
- return $c('runserverobj', args={'method':'update_status', 'arg': 'Submitted','docs': frappe.model.compress(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
+ return $c('runserverobj', args={'method':'update_status', 'arg': 'Submitted','docs': doc}, function(r,rt) {
cur_frm.refresh();
});
}
diff --git a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.js b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.js
index 328ca1d..c6ac73c 100644
--- a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.js
+++ b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.js
@@ -94,8 +94,7 @@
cur_frm.cscript.generate_schedule = function(doc, cdt, cdn) {
if (!doc.__islocal) {
- return $c('runserverobj', args={'method':'generate_schedule',
- 'docs':frappe.model.compress(make_doclist(cdt,cdn))},
+ return $c('runserverobj', args={'method':'generate_schedule', 'docs':doc},
function(r, rt) {
refresh_field('maintenance_schedule_detail');
});
diff --git a/erpnext/support/doctype/newsletter/newsletter.js b/erpnext/support/doctype/newsletter/newsletter.js
index dfa9af9..5c88692 100644
--- a/erpnext/support/doctype/newsletter/newsletter.js
+++ b/erpnext/support/doctype/newsletter/newsletter.js
@@ -17,7 +17,7 @@
if(!doc.__islocal && !cint(doc.email_sent) && !doc.__unsaved
&& inList(frappe.boot.user.can_write, doc.doctype)) {
cur_frm.add_custom_button(frappe._('Send'), function() {
- return $c_obj(make_doclist(doc.doctype, doc.name), 'send_emails', '', function(r) {
+ return $c_obj(doc, 'send_emails', '', function(r) {
cur_frm.refresh();
});
})