[minor] added get_terms methods to erpnext.utils so that it can be used in non transactional documents (#9037)
This commit is contained in:
parent
4b12896941
commit
157c334737
@ -5,8 +5,10 @@ frappe.provide("erpnext.offer_letter");
|
|||||||
|
|
||||||
frappe.ui.form.on("Offer Letter", {
|
frappe.ui.form.on("Offer Letter", {
|
||||||
select_terms: function(frm) {
|
select_terms: function(frm) {
|
||||||
frappe.model.get_value("Terms and Conditions", frm.doc.select_terms, "terms", function(value) {
|
erpnext.utils.get_terms(frm.doc.select_terms, frm.doc, function(r) {
|
||||||
frm.set_value("terms", value.terms);
|
if(!r.exc) {
|
||||||
|
me.frm.set_value("terms", r.message);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -993,20 +993,12 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
|||||||
|
|
||||||
get_terms: function() {
|
get_terms: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
if(this.frm.doc.tc_name) {
|
|
||||||
return frappe.call({
|
erpnext.utils.get_terms(this.frm.doc.tc_name, this.frm.doc, function(r) {
|
||||||
method: 'erpnext.setup.doctype.terms_and_conditions.terms_and_conditions.get_terms_and_conditions',
|
|
||||||
args: {
|
|
||||||
template_name: this.frm.doc.tc_name,
|
|
||||||
doc: this.frm.doc
|
|
||||||
},
|
|
||||||
callback: function(r) {
|
|
||||||
if(!r.exc) {
|
if(!r.exc) {
|
||||||
me.frm.set_value("terms", r.message);
|
me.frm.set_value("terms", r.message);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
taxes_and_charges: function() {
|
taxes_and_charges: function() {
|
||||||
|
@ -104,6 +104,21 @@ $.extend(erpnext.utils, {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
refresh_field(table_fieldname);
|
refresh_field(table_fieldname);
|
||||||
|
},
|
||||||
|
|
||||||
|
get_terms: function(tc_name, doc, callback) {
|
||||||
|
if(tc_name) {
|
||||||
|
return frappe.call({
|
||||||
|
method: 'erpnext.setup.doctype.terms_and_conditions.terms_and_conditions.get_terms_and_conditions',
|
||||||
|
args: {
|
||||||
|
template_name: tc_name,
|
||||||
|
doc: doc
|
||||||
|
},
|
||||||
|
callback: function(r) {
|
||||||
|
callback(r)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user