Merge pull request #6345 from rohitwaghchaure/employee_name_missing

[Fix] Employee name is missing in timesheet
This commit is contained in:
Nabin Hait 2016-09-12 17:34:13 +05:30 committed by GitHub
commit f314494555
2 changed files with 6 additions and 0 deletions

View File

@ -316,3 +316,4 @@ erpnext.patches.v7_0.repost_gle_for_pos_sales_return
erpnext.patches.v7_0.update_missing_employee_in_timesheet
erpnext.patches.v7_0.update_status_for_timesheet
erpnext.patches.v7_0.set_party_name_in_payment_entry
execute:frappe.db.sql("update `tabTimesheet` ts, `tabEmployee` emp set ts.employee_name = emp.employee_name where emp.name = ts.employee and ts.employee_name is null and ts.employee is not null")

View File

@ -20,12 +20,17 @@ class OverProductionLoggedError(frappe.ValidationError): pass
class Timesheet(Document):
def validate(self):
self.set_employee_name()
self.set_status()
self.validate_dates()
self.validate_time_logs()
self.update_cost()
self.calculate_total_amounts()
def set_employee_name(self):
if self.employee and not self.employee_name:
self.employee_name = frappe.db.get_value('Employee', self.employee, 'employee_name')
def calculate_total_amounts(self):
self.total_hours = 0.0
self.total_billing_amount = 0.0