Custom DocType & Calendar

Good day everyone! I can’t figure out how to implement it. I have created a Custom DocType Task_new. Using ServerScript I show users only those Task_new where it is designated. But it is necessary that in the calendar each user can see all Task_new of all users, but at the same time in other Lists they should see only where it is listed. How to solve such a thing.
Here’s the ServerScript:

user = frappe.session.user
if user == "Administrator":
    pass
else:
    # SQL-условие для отображения задач, где текущий пользователь указан в любом из перечисленных полей
    conditions = f"""(
        `tabTask_new`.name in (
            select `tabTask_new`.name 
            from `tabTask_new` 
            where 
                `tabTask_new`.name_isp = '{user}'
                or `tabTask_new`.otv = '{user}'
                or `tabTask_new`.name_utv = '{user}'
                or `tabTask_new`.name_ruk = '{user}'
                or `tabTask_new`.name_admin = '{user}'
                or `tabTask_new`.name_nadl = '{user}'
                or `tabTask_new`.name_nadl_2 = '{user}'
        )
    )"""

Hi @ktotut:

Check this thread, it will be helpful.

1 Like

I will try to explain. I now have Task_new created in the custom DocType in the Project module (in it, each user can create a task document for another user). In order for each user to see only those tasks in the Task_new list where he is a participant (director, performer, observer, etc.), I created a Server Script that shows him only the necessary documents in the list. But now you need to be able to go to the calendar and see the entries there