Customization of window "Assigned To" appearing in DocType Task

Hi! I need to add choose of “Color” (mandatory field) to a dialog window “Assigned to” created form Task.
In DocType “ToDo” this field is checked as mandatory it is written as mistake - that is not chosen.
But field don’t appear in the form, what should be additional done it to add?

1
2

1 Like

Hi @moistcity999:

This dialog is built here:

Anyway, by default, color field is not mandatory in ToDo doctype … so, could you just uncheck it :slight_smile:

Maybe I am missunderstanding something …
Hope this helps.

Hi!
Yes, it is not mandatory, but I’m trying to add, cause we need to choose it each time.
Here is no fields like “Assign to”, “Complete by”, “Priority”.
So I don’t understand yet where to add “Color”, I’m new at ERPNext :frowning:

Ok. This dialog don’t consider mandatory or other field properties …
I think that this customization needs to override assign_to.js and assign_to.py files

Other approach, maybe it works for you:

  • Set mandatory color on Task Doctype
  • Create a server script for ToDo Doctype

This way, ToDo will inherits task color …

Hope this helps.

[avc] thank you very much for script!
override assign_to.js and assign_to.py files is out of my understanding now. It could be a solution to add there choose of the colour for User I suppose.

But on the base of script I made another idea (one part): now ERP inherits color for different priotities itself and it works:

if doc.priority == “High” and doc.reference_type == “Task”:
doc.color = “#CB2929
if doc.priority == “Medium” or doc.priority == “Low” and doc.reference_type == “Task”:
doc.color = “#449CF0

I also wish ERP inherits another different colors for each my project (one fixed colour for one project, second for another project and so one).
Spend some hours trying to make this, but there was no “Field” Project in ToDo, so I didn’t add it to this Script.
My new field “Project” created in ToDo don’t receive project_name when ToDo is created from Task.
1

Also maybe all Tasks of Project of one color, but it seems less logical then first. and also don’t know way.

Hi @moistcity999:

Add this line to your script …

doc.project = frappe.db.get_value("Task", doc.reference_name, "project")

(name “doc.project” could be different, check your custom field name).

Here some awesome stuff from @buildwithhussain :slight_smile:

Hope this helps.

2 Likes

doc.project = frappe.db.get_value(“Task”, doc.reference_name, “project”)
if doc.priority == “High” and doc.reference_type == “Task”:
doc.color = “#CB2929
if doc.priority == “Medium” or doc.priority == “Low” and doc.reference_type == “Task”:
if doc.project == ‘PROJ-0001’:
doc.color = “#449CF0
if doc.project == ‘PROJ-0002’:
doc.color = “#f0f71e

It works! I got it! :smiley: Thank you very much for you time and help :pray:
thanks for link too, I’ll learn it

1 Like