Hello,
I’m working on an opportunity workflow, and I wrote a client script that changes a value in the linked quotation document if the workflow status = Won so that quotation will be submitted.
I tried to change the database status and the docstatus as you see in the code below but i got this message “cannot edit standard fields”
// script in Opportunity form
after_workflow_action: function (frm) {
// get the list of qutations
frappe.db.get_list('Quotation', {
fields: ['name'],
filters: {
opportunity: frm.doc.name
}
}).then(records => {
for (let i = 0; i < records.length; i++) {
if (frm.doc.workflow_state == "Won") {
frappe.db.set_value('Quotation', records[i].name, 'status', 'Open')
.then(r => {
frappe.db.set_value('Quotation', records[i].name, 'docstatus', 1)
})
}
}
}
}