Try ERPNext Buy Support Partners Foundation

Error on delete ‘Price Item’ with server side script

I created custom document type ‘Item Price Approve’ to control creating ‘Price Item’ records and I created a server side script , the reference is my custom document type with script type ‘document type event’ which is ‘before save’.
I am trying to delete ‘Price Item’ record by name using the following code :

ItemPriceList = frappe.get_list(‘Item Price’, filters={“price_list”:doc.price_list,“item_code”:doc.item_code ,“valid_from”:doc.valid_from}, fields=[“name”],limit_page_length=1);
frappe.delete_doc('Item Price', ItemPriceList[0].name);

on save I got the following error message :
TypeError: ‘NoneType’ object is not callable