Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: cannot create task with *Apply Strict User Permissions* #27214

Closed
wants to merge 13 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion erpnext/projects/doctype/task/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from frappe.model.mapper import get_mapped_doc
from frappe.utils import add_days, cstr, date_diff, get_link_to_form, getdate, today, flt
from frappe.utils.nestedset import NestedSet

from frappe.defaults import get_user_default

class CircularReferenceError(frappe.ValidationError): pass
class EndDateCannotBeGreaterThanProjectEndDateError(frappe.ValidationError): pass
Expand Down Expand Up @@ -318,6 +318,13 @@ def add_node():

if args.parent_task == 'All Tasks' or args.parent_task == args.project:
args.parent_task = None
if args.parent_task == args.project:
args.company == frappe.get_value('Project', args.project, 'company')
else:
args.company == get_user_default('company')

else:
args.company = frappe.get_value('Task', args.parent_task, 'company')

frappe.get_doc(args).insert()

Expand All @@ -326,6 +333,7 @@ def add_multiple_tasks(data, parent):
data = json.loads(data)
new_doc = {'doctype': 'Task', 'parent_task': parent if parent!="All Tasks" else ""}
new_doc['project'] = frappe.db.get_value('Task', {"name": parent}, 'project') or ""
new_doc['company'] = frappe.db.get_value('Task', {"name": parent}, 'company') or get_user_default('company')

for d in data:
if not d.get("subject"): continue
Expand Down