From ac91030b31f1108b7e32844f12a3a6c916c0120f Mon Sep 17 00:00:00 2001 From: Rucha Mahabal Date: Tue, 21 Nov 2023 13:18:34 +0530 Subject: [PATCH] fix(Timesheet): warn user if billing hours > actual hours instead of resetting (#38239) * revert: "fix(Timesheet): reset billing hours equal to hours if they exceed actual hours" This reverts commit 0ec8034507996f06eaf8ca13a414d10b34038c6c. * fix: warn user if billing hours > actual hours --- erpnext/projects/doctype/timesheet/timesheet.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/erpnext/projects/doctype/timesheet/timesheet.py b/erpnext/projects/doctype/timesheet/timesheet.py index 8e464b5c6b..b9d801ce90 100644 --- a/erpnext/projects/doctype/timesheet/timesheet.py +++ b/erpnext/projects/doctype/timesheet/timesheet.py @@ -69,8 +69,14 @@ class Timesheet(Document): def update_billing_hours(self, args): if args.is_billable: - if flt(args.billing_hours) == 0.0 or flt(args.billing_hours) > flt(args.hours): + if flt(args.billing_hours) == 0.0: args.billing_hours = args.hours + elif flt(args.billing_hours) > flt(args.hours): + frappe.msgprint( + _("Warning - Row {0}: Billing Hours are more than Actual Hours").format(args.idx), + indicator="orange", + alert=True, + ) else: args.billing_hours = 0