Hi All,
Our Company need some Pre-Sale actions like, taking survey, proposal drawing, price analysis. i make a script to create project against opportunity and add Tasks against it with frappe.db.insert
. everything work as expected.
But i would like to add a Cancel
button in any case of created with wrong template or that opportunity is cancelled. i manage to make Tasks are cancelled state with frappe.client.set_value
but project field percent_complete
is not show right value after cancel. When i open project and save it its show normal values.
I know Task is pushing status via save, and Project pull Tasks status via save and i added directly on database. I have been checked github and Whitelisted endpoints, project updates endpoints in project.py and task.py aren’t whitelisted. Is there any way to call them or is there any way to save project doc after frappe.client.set_value
?
one of my task cancel call
cur_frm.cscript.cancel = function(frm, cdt, cdn){
var d = locals[cdt][cdn];
frappe.call({
method: 'frappe.client.get_value',
args: {
doctype: 'Task',
filters: {
'project': d.project,
'opportunity': d.name,
'subject': 'Survey',
},
fieldname: ['name', 'status']
}, callback: function (data) {
if (data.message.status = 'Open' || data.message.status = 'Overdue'){
frappe.msgprint(data.message.name);
frappe.call({
method: 'frappe.client.set_value',
'args': {
'doctype': 'Task',
'name': data.message.name,
fieldname: {
'status': 'Cancelled',
},
}
});
}
}
});
};