Hello,
I’m using some custom scripts on Quotation, Sales Order, Sales Invoice and Payment Entry. Every time I make a new document, first Save and then Submit. At this point everything is fine as usual.
But (for example) if I make a Sales Order directly from Quotation, the Quotation status turns to “Not Saved” and the button that should indicates “Cancel”, it says “Update”.
I’ve being trying some changes at the customs scripts to try to fix this, but the issue remains…
cur_frm.add_fetch("item_code", "uso", "uso");
cur_frm.add_fetch("item_code", "tipo_de_servicio", "tipo_de_servicio");
cur_frm.add_fetch("customer", "fecha_nacimiento", "fecha_nacimiento");
cur_frm.add_fetch("tipo_de_orden", "tipo_orden_descripcion", "tipo_orden_descripcion");
frappe.ui.form.on("Quotation", "tipo_de_orden", function(frm) {cur_frm.fields_dict['items'].grid.get_field('item_code').get_query = function(doc) {
if (frm.doc.tipo_de_orden=='Agencia Funeraria'){
return {
filters: [
['Item', 'item_group', 'in', doc.tipo_de_orden]
]
}
}
else {
return {
filters: [
['Item', 'item_group', 'in', [doc.tipo_de_orden, 'Todos los Grupos de Artículos']]
]
}
}
};
});
frappe.ui.form.on("Quotation", "oficialia", function(frm) {
if (frm.doc.oficialia=="01"){
frm.set_value("localidad", "CIUDAD NICOLAS ROMERO");
validate = true;
};
if (frm.doc.oficialia=="02"){
frm.set_value("localidad", "LA COLMENA");
validate = true;
};
});
frappe.ui.form.on("Quotation Item", {
base_rate: function(frm, cdt, cdn) {
var d = locals[cdt][cdn];
frappe.model.set_value(d.doctype, d.name, "pagos", (d.base_rate - d.enganche)/d.meses);
validate = true;
}
});
frappe.ui.form.on("Quotation Item", {
enganche: function(frm, cdt, cdn) {
var d = locals[cdt][cdn];
frappe.model.set_value(d.doctype, d.name, "pagos", (d.base_rate - d.enganche)/d.meses);
validate = true;
}
});
frappe.ui.form.on("Quotation Item", {
meses: function(frm, cdt, cdn) {
var d = locals[cdt][cdn];
frappe.model.set_value(d.doctype, d.name, "pagos", (d.base_rate - d.enganche)/d.meses);
validate = true;
}
});
When I go back to Quotation and clic “Update”, a message indicates that any of the custom fields I created, cannot be updated after validate.
Any thought what I’m missing or what I maybe doing wrong?