Update update_sales_cost_in_project.py (#11595)
Will break if select sum(base_grand_total) from `tabSales Order` where project=p.name and docstatus=1 returns Null. Gives - "OperationalError: (1048, "Column 'total_sales_cost' cannot be null")" Error
This commit is contained in:
parent
8e5dcd06fb
commit
0df93d61eb
@ -1,4 +1,4 @@
|
|||||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
# Copyright (c) 2013, Frappé Technologies Pvt. Ltd. and Contributors
|
||||||
# License: GNU General Public License v3. See license.txt
|
# License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
@ -7,6 +7,6 @@ import frappe
|
|||||||
def execute():
|
def execute():
|
||||||
frappe.db.sql("""
|
frappe.db.sql("""
|
||||||
update `tabProject` p
|
update `tabProject` p
|
||||||
set total_sales_cost = (select sum(base_grand_total)
|
set total_sales_cost = ifnull((select sum(base_grand_total)
|
||||||
from `tabSales Order` where project=p.name and docstatus=1)
|
from `tabSales Order` where project=p.name and docstatus=1), 0)
|
||||||
""")
|
""")
|
Loading…
x
Reference in New Issue
Block a user