fix: Remove cmd only if exist (#12886)

* only remove cmd if exist

When calling this function from backend this line raises key error as there's no such key called cmd

* style: Simplify code

Co-authored-by: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com>
This commit is contained in:
mustafaelagamey 2021-04-18 06:46:19 +02:00 committed by Suraj Shetty
parent 50f9a7e1d8
commit d8dca020b3

View file

@ -66,7 +66,7 @@ def add_node():
doc.save()
def make_tree_args(**kwarg):
del kwarg['cmd']
kwarg.pop('cmd', None)
doctype = kwarg['doctype']
parent_field = 'parent_' + doctype.lower().replace(' ', '_')