Work Flow UI integration in ERPnext

hello everyone…

we would like to add a UI workflow to simplize some of the user contraction with the ERP and we need help in this as we dont have a python developer…

Like in SAP ERP workflow have a UI for the workflow and acceptation of the documents, the workflow is already in ERPnext but we feel its just not being used in the full way potentials of it…

a UI for the workflow and accept / Refuse buttons with a note to the reason will be much easier to be noticed than change the status of the document.

Do you want to post it on ?

@rmehta I would if it will be integrated into project not just my erp system…are you willing to change work flow core ?

@ramielian add the states Accepted and Rejected in your Workflow and add this custom script in the target doctype, dont forget of replace {doctype} by the name of your doctype!

This script listen to workflow state to save a description of the Rejection

frappe.ui.form.on("{DocType}", "after_save", function(frm, cdt, cdn){
		if (frm.doc.workflow_state && frm.doc.workflow_state.indexOf("Rejected") > 0){
					fieldtype: 'Small Text',
					reqd: true,
					fieldname: 'reason'
					validated = true;{
						method: '',
						args: {
							doctype: frm.doctype,
							name: frm.docname,
							subject: format(__('Reason for {0}'), [frm.doc.workflow_state]),
							content: args.reason,
							send_mail: false,
							send_me_a_copy: false,
							communication_medium: 'Other',
							sent_or_received: 'Sent'
						callback: function(res){
							if (res && !res.exc){{
									method: 'frappe.client.set_value',
									args: {
										doctype: frm.doctype,
										name: frm.docname,
										fieldname: 'rejection_reason',
										value: frm.doc.rejection_reason ?
											[frm.doc.rejection_reason, frm.doc.workflow_state].join('\n') : frm.doc.workflow_state
									callback: function(res){
										if (res && !res.exc){
				__('Reason for ') + frm.doc.workflow_state,
				__('End as Rejected')

Max, its not only the description that is needed (thanks for the script and the info ) but the workflow as a process is a bit hmmm, miss used maybe ?

Are you familiar with sap erp? So search for the workflow UI of it…

@ramielian, not I’m not familiar with SAP erp

Hello @max_morais_dmm,

What I have to do here if I don’t want to change the state of the workflow without entering the reason.?

I have implement exactly same like your code. I can see the prompt and everything but the document has been saved without entering the reason.

@nishith there’s no easy way to enforce the user to enter the information before the workflow go ahead.

Ok @max_morais_dmm, thanks a lot for the response. I have already implement that thing by setting up workflow_state manually on custom button click and removed workflow default action.