Deleting items from a child Table in another doctype

In my Salary Slip Doctype, I am running some conditions and if the conditions are met, I have to delete specific rows from a child table in Salary Structure doctype. Basically, I am trying to delete rows from a child table in another doctype from a different doctype. How can I proceed with this? Is there a built-in frappe method to achieve this?

i think you have problem in your logic
because when we make salary slip we get salary structure doc and apply every condition , if it is ok we add the item in child table (earning or deduction)
but when it is not ok for condition delete from salary structure !!!
i think you might revise it again because salary structure should be submitted and and what if the condition is ok next month , you will add in child table of salary structure again !!!
please meke your self more clear or tell us what you want to do

The salary structure is created by itself and will be referenced when a salary slip is created. Salary slip reads the earnings and deductions component from salary structure. I dont quite get what you are saying.

i donot get what you are doing but you can delete from child table in another doctype by

	            from `tabSalary Detail`
			            where parent = 'Salary Structure name'
					            and parenttype ='Salary Structure'
					            and parentfield = 'earnins or deductions'

make your sql like this and try

1 Like