2019-01-22 12:52:20 +00:00
|
|
|
from __future__ import unicode_literals
|
2016-07-22 07:54:33 +00:00
|
|
|
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()
|
2016-07-26 07:27:05 +00:00
|
|
|
ts.flags.ignore_validate = True
|
2016-07-26 15:17:42 +00:00
|
|
|
ts.flags.ignore_mandatory = True
|
2016-07-22 07:54:33 +00:00
|
|
|
ts.flags.ignore_validate_update_after_submit = True
|
2016-08-18 07:20:58 +00:00
|
|
|
ts.flags.ignore_links = True
|
2016-07-22 07:54:33 +00:00
|
|
|
ts.save()
|