Using document status instead of Workflow State

Hello to everyone,

Is there any way to display the document’s status instead of the workflow state in the list view of documents that require approval.

To be more specific, I would like to show the workflow state until it has reached “Approved”, and then based on separate parameters, show the appropriate status of the document.

For example:

Quotation is in draft, Status = Draft,
Quotation is submitted for approval, Status = Pending (from workflow_state),
Quotation is approved, Status = Approved (from workflow_state),
Quotation’s status has been changed to “Negotiation” by Sales Executive, Status should be = Negotiation
Quotation’s status has been changed to “Lost” by Sales Executive, Status should be = Lost

Thanks in advance!

BUMP

Can someone help me with this please?

Hi @Tanuj

Try below code

frappe.ui.form.on(DocType, “workflow_state”, function(frm, cdt, cdn){
if (frm.doc.worflow_state ==== “Draft”){
// do something
}else{
// do something
}
});

Thanks, Rohit

Hi @rohit_w,

Im not trying to run a code based on the workflow state. Im trying to set the list view from Workflow State to Status of the document.

Hi @Tanuj,

Under custom app create custom_quotation_list.js file and call it from app’s hooks file like as below

doctype_list_js = {
“Quotation”: “path of custom_quotation_list.js”,
}

Write your logic in custom_quotation_list.js file.
For reference you can check quotation_list.js file.

Thanks, Rohit

1 Like

Hi @rohit_w,

Thanks for the suggestion, but it didnt work. The workflow state seems to be overriding the status.

Steps I followed:

  1. Created cust_quotation_list.js with correct settings.
  2. Edited erpnext/hooks.py to add:
    doctype_list_js = { "Quotation": "erpnext/selling/doctype/quotation/cust_quotation_list.js" }
  3. Restarted Supervisor

Hi @Tanuj,

Run following commands and check

bench clear-cache
bench build

Thanks, Rohit

@rohit_w
Still nothing.

Do i need to reference the hook somewhere?

What about displaying both standard status and workflow_status side by side…

see below ‘purchase order’ document that I am using where both standard and workflow states are displayed! This works for me…

2 Likes

@Basawaraj_Savalagi

Could you tell me how you did that?

Thanks!

  1. After creating the workflow for any doctype, go to customize form and select the doctype.
  2. you will see a field called ‘workflow_state’
    3.check ‘In List View’ for workflow_state field.
    4.You may have to uncheck ‘In List View’ for some other field as in ‘List View’ there is limited space…
2 Likes

Hello,

Here is my list view. I need to get different status for both Workflow and Status

Not sure what you mean by that!

Did you define a workflow with workflow states?

I also tried same, you need to re-order field Wofkflow_state and Status from Customise Doctype and need to bring down Workflow state to Status field.
Re-login and check. I also couldnt understand the logic behind it but it work for me.

Yes I define a workflow_states which was Approved, Pending, Cancel.

That why I want if the workflow_state and the document status have could have different status.

@sione

Did you find a solution for this?

@fasilkaks

No…I ended up just using the Workflow State

Hello @sione @fasilkaks @Sumit_Arora @Basawaraj_Savalagi

I believe the standard status that you are looking to change it is the get_indicator that is existed in the filename_list.js so it is not a field.

Please check and advise.

Regards
Bilal

Note, this to work set ‘Don’t Override Status’ to true i.e. If Checked workflow status will not override status in list view

Continuing the discussion from Using document status instead of Workflow State:

Is there a way to add the Workflow State on the Status of the document? So that I do not need to have both viewing of the Status and Workflow status on the list view. Also, no need to enable or disable the ‘Don’t Override Status’.

Example I wanted to add the following workflow status on the Purchase Order:

Rejected by Purchase Manager
Pending Approval by Purchase Manager
Approved by Purchase Manager

However, once the Purchase Order is submitted, I also want to keep the “to receive and bill”, “to bill”, etc standard status on the document.

How can I achieve this?