Delete a child table row of some other document using python

Delete a child table row of some other document using python, While in some other doctype I want to delete a child row of another doctype, how to achieve this? I tried and fetch that document of child table and delete it but it says submitted document cannot be deleted

In most cases the difference between unSubmitted and Submitted is reflected in the record attribute docstatus. Often draft is docstatus = 0 and submitted is docstatus = 1. DocTypes with a more complex workflow may define those differently.

Trying to remove a single row (identified by “detailName”) from a child table (“details”) of a DocType (“master”), I found that this works:

def removeSingleRow(master, detailName):
  theDetail = None
  for detail in master.details:
    if == detailName:
      theDetail = detail


I have not checked on the effect of the docstatus flag on that operation. There are a number of possibilities to consider:

  • docstatus of master
  • docstatus of details child table
  • docstatus of details row
  • Allow on Submit setting of any of the above