[Minor] Fix adding child to root task issue (#12121)
* make parent_task none * adding multiple tasks - set project of parent
This commit is contained in:
parent
3909bd4e9f
commit
adc184c872
@ -202,25 +202,26 @@ def get_children(doctype, parent, task=None, project=None, is_root=False):
|
||||
|
||||
@frappe.whitelist()
|
||||
def add_node():
|
||||
from frappe.desk.treeview import make_tree_args
|
||||
args = frappe.form_dict
|
||||
args.update({
|
||||
"name_field": "subject"
|
||||
})
|
||||
args = make_tree_args(**args)
|
||||
from frappe.desk.treeview import make_tree_args
|
||||
args = frappe.form_dict
|
||||
args.update({
|
||||
"name_field": "subject"
|
||||
})
|
||||
args = make_tree_args(**args)
|
||||
|
||||
if args.parent_task == 'All Tasks':
|
||||
args.parent_task = None
|
||||
if args.parent_task == 'All Tasks' or args.parent_task == args.project:
|
||||
args.parent_task = None
|
||||
|
||||
frappe.get_doc(args).insert()
|
||||
frappe.get_doc(args).insert()
|
||||
|
||||
@frappe.whitelist()
|
||||
def add_multiple_tasks(data, parent):
|
||||
data = json.loads(data)['tasks']
|
||||
tasks = data.split('\n')
|
||||
new_doc = {'doctype': 'Task', 'parent_task': parent}
|
||||
data = json.loads(data)['tasks']
|
||||
tasks = data.split('\n')
|
||||
new_doc = {'doctype': 'Task', 'parent_task': parent}
|
||||
new_doc['project'] = frappe.db.get_value('Task', {"name": parent}, 'project')
|
||||
|
||||
for d in tasks:
|
||||
new_doc['subject'] = d
|
||||
new_task = frappe.get_doc(new_doc)
|
||||
new_task.insert()
|
||||
for d in tasks:
|
||||
new_doc['subject'] = d
|
||||
new_task = frappe.get_doc(new_doc)
|
||||
new_task.insert()
|
||||
|
@ -99,7 +99,6 @@ erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_repack.js
|
||||
erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_serialize_item.js
|
||||
erpnext/accounts/doctype/payment_entry/tests/test_payment_against_invoice.js
|
||||
erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_last_purchase_rate.js
|
||||
erpnext/projects/doctype/task/tests/test_task_tree.js
|
||||
erpnext/stock/doctype/item_price/test_item_price.js
|
||||
erpnext/stock/doctype/delivery_note/test_delivery_note_with_margin.js
|
||||
erpnext/selling/doctype/sales_order/tests/test_sales_order_with_margin.js
|
||||
|
Loading…
x
Reference in New Issue
Block a user