[fix] new_doc to frappe.new_doc

This commit is contained in:
Rushabh Mehta 2016-06-01 11:46:33 +05:30
parent 919b1b9d5b
commit aa60fd9037
6 changed files with 9 additions and 41 deletions

View File

@ -51,7 +51,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
this.make_sales_return, __("Make")); this.make_sales_return, __("Make"));
cur_frm.page.set_inner_btn_group_as_primary(__("Make")); cur_frm.page.set_inner_btn_group_as_primary(__("Make"));
} }
if(cint(doc.update_stock)!=1) { if(cint(doc.update_stock)!=1) {
// show Make Delivery Note button only if Sales Invoice is not created from Delivery Note // show Make Delivery Note button only if Sales Invoice is not created from Delivery Note
var from_delivery_note = false; var from_delivery_note = false;
@ -61,7 +61,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
}); });
if(!from_delivery_note && !is_delivered_by_supplier) { if(!from_delivery_note && !is_delivered_by_supplier) {
cur_frm.add_custom_button(__('Delivery'), cur_frm.cscript['Make Delivery Note'], cur_frm.add_custom_button(__('Delivery'), cur_frm.cscript['Make Delivery Note'],
__("Make")); __("Make"));
} }
} }
@ -221,7 +221,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
frm: cur_frm frm: cur_frm
}) })
}, },
asset: function(frm, cdt, cdn) { asset: function(frm, cdt, cdn) {
var row = locals[cdt][cdn]; var row = locals[cdt][cdn];
if(row.asset) { if(row.asset) {
@ -390,7 +390,7 @@ cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
if(cur_frm.doc.is_pos) { if(cur_frm.doc.is_pos) {
cur_frm.msgbox = frappe.msgprint(format('<a class="btn btn-primary" \ cur_frm.msgbox = frappe.msgprint(format('<a class="btn btn-primary" \
onclick="cur_frm.print_preview.printit(true)" style="margin-right: 5px;">{0}</a>\ onclick="cur_frm.print_preview.printit(true)" style="margin-right: 5px;">{0}</a>\
<a class="btn btn-default" href="javascript:new_doc(cur_frm.doctype);">{1}</a>', [ <a class="btn btn-default" href="javascript:frappe.new_doc(cur_frm.doctype);">{1}</a>', [
__('Print'), __('New') __('Print'), __('New')
])); ]));

View File

@ -27,22 +27,6 @@ frappe.ui.form.on("Supplier", {
frm.events.add_custom_buttons(frm); frm.events.add_custom_buttons(frm);
}, },
add_custom_buttons: function(frm) {
// ["Supplier Quotation", "Purchase Order", "Purchase Receipt", "Purchase Invoice"].forEach(function(doctype, i) {
// if(frappe.model.can_read(doctype)) {
// frm.add_custom_button(__(doctype), function() {
// frappe.route_options = {"supplier": frm.doc.name};
// frappe.set_route("List", doctype);
// }, __("View"));
// }
// if(frappe.model.can_create(doctype)) {
// frm.add_custom_button(__(doctype), function() {
// frappe.route_options = {"supplier": frm.doc.name};
// new_doc(doctype);
// }, __("Make"));
// }
// });
},
}); });
cur_frm.fields_dict['default_price_list'].get_query = function(doc, cdt, cdn) { cur_frm.fields_dict['default_price_list'].get_query = function(doc, cdt, cdn) {

View File

@ -39,7 +39,7 @@ frappe.ui.form.on("Newsletter List", "refresh", function(frm) {
frm.add_custom_button(__("New Newsletter"), function() { frm.add_custom_button(__("New Newsletter"), function() {
frappe.route_options = {"newsletter_list": frm.doc.name}; frappe.route_options = {"newsletter_list": frm.doc.name};
new_doc("Newsletter"); frappe.new_doc("Newsletter");
}, __("Action")); }, __("Action"));
} }

View File

@ -20,11 +20,11 @@ frappe.ui.form.on("Job Applicant", {
"applicant_name": frm.doc.applicant_name, "applicant_name": frm.doc.applicant_name,
"designation": frm.doc.job_opening, "designation": frm.doc.job_opening,
}; };
new_doc("Offer Letter"); frappe.new_doc("Offer Letter");
}, __("Make")); }, __("Make"));
cur_frm.page.set_inner_btn_group_as_primary(__("Make")); cur_frm.page.set_inner_btn_group_as_primary(__("Make"));
} }
} }
} }
}); });

View File

@ -93,7 +93,7 @@ $.extend(erpnext.utils, {
.html(frappe.render_template("address_list", .html(frappe.render_template("address_list",
cur_frm.doc.__onload)) cur_frm.doc.__onload))
.find(".btn-address").on("click", function() { .find(".btn-address").on("click", function() {
new_doc("Address"); frappe.new_doc("Address");
}); });
// render contact // render contact
@ -102,7 +102,7 @@ $.extend(erpnext.utils, {
.html(frappe.render_template("contact_list", .html(frappe.render_template("contact_list",
cur_frm.doc.__onload)) cur_frm.doc.__onload))
.find(".btn-contact").on("click", function() { .find(".btn-contact").on("click", function() {
new_doc("Contact"); frappe.new_doc("Contact");
} }
); );
} }

View File

@ -30,22 +30,6 @@ frappe.ui.form.on("Customer", {
frm.events.add_custom_buttons(frm); frm.events.add_custom_buttons(frm);
}, },
add_custom_buttons: function(frm) {
// ["Opportunity", "Quotation", "Sales Order", "Delivery Note", "Sales Invoice"].forEach(function(doctype, i) {
// if(frappe.model.can_read(doctype)) {
// frm.add_custom_button(__(doctype), function() {
// frappe.route_options = {"customer": frm.doc.name};
// frappe.set_route("List", doctype);
// }, __("View"));
// }
// if(frappe.model.can_create(doctype)) {
// frm.add_custom_button(__(doctype), function() {
// frappe.route_options = {"customer": frm.doc.name};
// new_doc(doctype);
// }, __("Make"));
// }
// });
},
validate: function(frm) { validate: function(frm) {
if(frm.doc.lead_name) frappe.model.clear_doc("Lead", frm.doc.lead_name); if(frm.doc.lead_name) frappe.model.clear_doc("Lead", frm.doc.lead_name);
} }