Merge pull request #23622 from AfshanKhan/fix-billing-summary-report-precision

fix: setting user defined precision instead of 2
This commit is contained in:
rohitwaghchaure 2020-10-13 22:46:02 +05:30 committed by GitHub
commit 4d93bfebd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,6 +6,7 @@ from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import time_diff_in_hours, flt
from frappe.model.meta import get_field_precision
def get_columns():
return [
@ -136,6 +137,7 @@ def get_timesheet_details(filters, timesheet_list):
return timesheet_details_map
def get_billable_and_total_duration(activity, start_time, end_time):
precision = frappe.get_precision("Timesheet Detail", "hours")
activity_duration = time_diff_in_hours(end_time, start_time)
billing_duration = 0.0
if activity.billable:
@ -143,4 +145,4 @@ def get_billable_and_total_duration(activity, start_time, end_time):
if activity_duration != activity.billing_hours:
billing_duration = activity_duration * activity.billing_hours / activity.hours
return flt(activity_duration, 2), flt(billing_duration, 2)
return flt(activity_duration, precision), flt(billing_duration, precision)