brotherton-erpnext/erpnext/patches/v8_0/update_sales_cost_in_project.py
2017-11-17 12:12:53 +05:30

9 lines
247 B
Python

from __future__ import unicode_literals
import frappe
def execute():
frappe.db.sql("""
update `tabProject` p
set total_sales_cost = ifnull((select sum(base_grand_total)
from `tabSales Order` where project=p.name and docstatus=1), 0)
""")