frappe.ui.form.on("Sales Order", "generate_document", function(frm, doctype, name) {
frappe.model.open_mapped_doc({
method: "ngse.ngse_doc.ef_doc.apply_comment",
frm: cur_frm
});
});
frappe.ui.form.on("Sales Order", "refresh", function(frm, doctype, name) {
cur_frm.add_custom_button(__('Generate Document'), function() {
msgprint(frm.doc.owner)
msgprint(frm.doc.doctype)
var d = frappe.prompt([
{'fieldname': 'birth', 'fieldtype': 'Date', 'label': 'Birth Date', 'reqd': 0},
{'fieldname': 'comment', 'fieldtype': 'Text', 'label': 'Comment', 'reqd': 1}
],
function(values){
var c = d.get_values()
var cmnt = c.comment
var me = frm.doc
return frappe.call({
method: "frappe.desk.form.utils.add_comment",
args: {
doc:{
doctype: "Comment",
comment_type: "Comment",
comment_doctype: frm.doc.doctype,
comment_docname: frm.doc.name,
comment: cmnt,
comment_by: user
}
},
callback: function(r) {
if(!r.exc) {
frm.get_docinfo().comments =
me.get_comments().concat([r.message]);
input.val("");
refresh(true);
}
}
});
},
'Age verification',
'Subscribe me'
)
}, "icon-exclamation", "btn-default");
});
frappe.ui.form.on("Sales Order", "press_me", function(frm, doctype, name) {
msgprint(frm.doc.owner)
msgprint(frm.doc.doctype)
var d = frappe.prompt([
{'fieldname': 'birth', 'fieldtype': 'Date', 'label': 'Birth Date', 'reqd': 0},
{'fieldname': 'comment', 'fieldtype': 'Text', 'label': 'Comment', 'reqd': 1}
],
function(values){
var c = d.get_values()
var cmnt = c.comment
var me = frm.doc
return frappe.call({
method: "frappe.desk.form.utils.add_comment",
args: {
doc:{
doctype: "Comment",
comment_type: "Comment",
comment_doctype: frm.doc.doctype,
comment_docname: frm.doc.name,
comment: cmnt,
comment_by: user
}
},
callback: function(r) {
if(!r.exc) {
frm.get_docinfo().comments =
me.get_comments().concat([r.message]);
input.val("");
refresh(true);
}
}
});
},
'Age verification',
'Subscribe me'
)
});
frappe.model.open_mapped_doc({
method: "ngse.ngse_doc.ef_doc.apply_comment",
frm: cur_frm
});
});
frappe.ui.form.on("Sales Order", "refresh", function(frm, doctype, name) {
cur_frm.add_custom_button(__('Generate Document'), function() {
msgprint(frm.doc.owner)
msgprint(frm.doc.doctype)
var d = frappe.prompt([
{'fieldname': 'birth', 'fieldtype': 'Date', 'label': 'Birth Date', 'reqd': 0},
{'fieldname': 'comment', 'fieldtype': 'Text', 'label': 'Comment', 'reqd': 1}
],
function(values){
var c = d.get_values()
var cmnt = c.comment
var me = frm.doc
return frappe.call({
method: "frappe.desk.form.utils.add_comment",
args: {
doc:{
doctype: "Comment",
comment_type: "Comment",
comment_doctype: frm.doc.doctype,
comment_docname: frm.doc.name,
comment: cmnt,
comment_by: user
}
},
callback: function(r) {
if(!r.exc) {
frm.get_docinfo().comments =
me.get_comments().concat([r.message]);
input.val("");
refresh(true);
}
}
});
},
'Age verification',
'Subscribe me'
)
}, "icon-exclamation", "btn-default");
});
frappe.ui.form.on("Sales Order", "press_me", function(frm, doctype, name) {
msgprint(frm.doc.owner)
msgprint(frm.doc.doctype)
var d = frappe.prompt([
{'fieldname': 'birth', 'fieldtype': 'Date', 'label': 'Birth Date', 'reqd': 0},
{'fieldname': 'comment', 'fieldtype': 'Text', 'label': 'Comment', 'reqd': 1}
],
function(values){
var c = d.get_values()
var cmnt = c.comment
var me = frm.doc
return frappe.call({
method: "frappe.desk.form.utils.add_comment",
args: {
doc:{
doctype: "Comment",
comment_type: "Comment",
comment_doctype: frm.doc.doctype,
comment_docname: frm.doc.name,
comment: cmnt,
comment_by: user
}
},
callback: function(r) {
if(!r.exc) {
frm.get_docinfo().comments =
me.get_comments().concat([r.message]);
input.val("");
refresh(true);
}
}
});
},
'Age verification',
'Subscribe me'
)
});
No comments:
Post a Comment