Merge pull request #6211 from rohitwaghchaure/v7.1_fixes

[Fix] Billing Hours showing blank on sales invoice
This commit is contained in:
Nabin Hait 2016-08-31 12:12:48 +05:30 committed by GitHub
commit 566759acae
3 changed files with 12 additions and 1 deletions

View File

@ -483,4 +483,5 @@ frappe.ui.form.on('Sales Invoice Timesheet', {
}
})
cur_frm.add_fetch("time_sheet", "total_billing_hours", "billing_hours");
cur_frm.add_fetch("time_sheet", "total_billing_amount", "billing_amount");

View File

@ -83,6 +83,7 @@ class SalesInvoice(SellingController):
self.validate_time_sheets_are_submitted()
self.validate_multiple_billing("Delivery Note", "dn_detail", "amount", "items")
self.update_packing_list()
self.set_billing_hours_and_amount()
self.calculate_billing_amount_from_timesheet()
def before_save(self):
@ -440,6 +441,15 @@ class SalesInvoice(SellingController):
else:
self.set('packed_items', [])
def set_billing_hours_and_amount(self):
for timesheet in self.timesheets:
ts_doc = frappe.get_doc('Timesheet', timesheet.time_sheet)
if not timesheet.billing_hours and ts_doc.total_billing_hours:
timesheet.billing_hours = ts_doc.total_billing_hours
if not timesheet.billing_amount and ts_doc.total_billing_amount:
timesheet.billing_amount = ts_doc.total_billing_amount
def calculate_billing_amount_from_timesheet(self):
total_billing_amount = 0.0
for data in self.timesheets:

View File

@ -313,7 +313,7 @@ def get_events(start, end, filters=None):
conditions = get_conditions(filters)
return frappe.db.sql("""select `tabTimesheet Detail`.name as name, `tabTimesheet Detail`.parent as parent,
from_time, hours, activity_type, project, to_time from `tabTimesheet Detail`,
`tabTimesheet` where `tabTimesheet Detail`.parent = `tabTimesheet`.name and
`tabTimesheet` where `tabTimesheet Detail`.parent = `tabTimesheet`.name and `tabTimesheet`.docstatus < 2 and
(from_time between %(start)s and %(end)s) {conditions}""".format(conditions=conditions),
{
"start": start,