How do I delete cancelled SO(sales order) from sales gross profit??
-Gross Profit is report which shows Invoice data not Order data. from where you want to delete SO.
- Delete option is available to delete ‘Cancel’ SO.
Thank you for your reply @shraddha. I want to delete the cancelled SO from sales gross profit list and not from sales order list.
Okay. so is your query get solved or not ??
No. I am trying to figure out. Can you help me??
Okay.Can you share screenshot?
Do I need to create a .py file for the same??
I want to check the cancelled SO from sales order list and delete the same from sales gross profit.How do I match the SO in sales order list and sales gross profit list whether same or not and then delete the SO from sales gross profit list. I have written the following py file but not working. Can someone tell me where exactly do i need to write this py file??
current file path: cd home/frappe/frappe-bench/apps/erpnext/erpnext/selling/report/sales_order/sales_order.py
from future import unicode_literals
from frappe import _
‘doctype’ : ‘Sales Order’,
‘status’ : ‘Cancelled’
if status.get(“Cancelled” and sales_gross_profit.sales_order = sales_order.name) :
‘tabSales Gross Profit’
sales_gross_profit.docstatus = 0
frappe.db.sql('Delete sales_order from
tabSales Gross Profit where sales_order in (select name from
tabSales Order where docstatus = 2 ) ')
Its neither giving me any error nor any output.