brotherton-erpnext/erpnext/patches/v7_0/calculate_total_costing_amount.py
Rohit Waghchaure c4afd63e50 [minor] Fixes
2016-07-26 20:47:42 +05:30

17 lines
517 B
Python

import frappe
from frappe.utils import flt
def execute():
frappe.reload_doc('projects', 'doctype', 'timesheet')
for data in frappe.get_all('Timesheet', fields=["name, total_costing_amount"],
filters = [["docstatus", "<", "2"]]):
if flt(data.total_costing_amount) == 0.0:
ts = frappe.get_doc('Timesheet', data.name)
ts.update_cost()
ts.calculate_total_amounts()
ts.flags.ignore_validate = True
ts.flags.ignore_mandatory = True
ts.flags.ignore_validate_update_after_submit = True
ts.save()