diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js index f59f5748f350..45369d2e80a5 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js @@ -446,12 +446,24 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte }, currency() { +<<<<<<< HEAD this._super(); $.each(cur_frm.doc.timesheets, function(i, d) { let row = frappe.get_doc(d.doctype, d.name) set_timesheet_detail_rate(row.doctype, row.name, cur_frm.doc.currency, row.timesheet_detail) }); calculate_total_billing_amount(cur_frm) +======= + var me = this; + super.currency(); + if (this.frm.doc.timesheets) { + this.frm.doc.timesheets.forEach((d) => { + let row = frappe.get_doc(d.doctype, d.name) + set_timesheet_detail_rate(row.doctype, row.name, me.frm.doc.currency, row.timesheet_detail) + }); + frm.trigger("calculate_timesheet_totals"); + } +>>>>>>> 09ccdee2db ( feat: add `total_billing_hours` to Sales Invoice (fp #26783) (#27742)) } }); @@ -996,6 +1008,7 @@ frappe.ui.form.on('Sales Invoice', { }); } }); +<<<<<<< HEAD frappe.ui.form.on("Sales Invoice Timesheet", { @@ -1004,6 +1017,14 @@ frappe.ui.form.on("Sales Invoice Timesheet", { } }); +======= + +frappe.ui.form.on("Sales Invoice Timesheet", { + timesheets_remove(frm) { + frm.trigger("calculate_timesheet_totals"); + } +}); +>>>>>>> 09ccdee2db ( feat: add `total_billing_hours` to Sales Invoice (fp #26783) (#27742)) var set_timesheet_detail_rate = function(cdt, cdn, currency, timelog) { frappe.call({ diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json index a24164487e61..23e4968f34ab 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json @@ -2015,6 +2015,13 @@ "label": "Dispatch Address", "read_only": 1 }, + { + "fieldname": "total_billing_hours", + "fieldtype": "Float", + "label": "Total Billing Hours", + "print_hide": 1, + "read_only": 1 + }, { "fieldname": "total_billing_hours", "fieldtype": "Float", @@ -2033,7 +2040,7 @@ "link_fieldname": "consolidated_invoice" } ], - "modified": "2021-09-28 13:09:34.391799", + "modified": "2021-10-02 03:36:10.251715", "modified_by": "Administrator", "module": "Accounts", "name": "Sales Invoice", diff --git a/erpnext/accounts/doctype/sales_invoice_timesheet/sales_invoice_timesheet.json b/erpnext/accounts/doctype/sales_invoice_timesheet/sales_invoice_timesheet.json index 2cddbbfceee9..92795818a0e8 100644 --- a/erpnext/accounts/doctype/sales_invoice_timesheet/sales_invoice_timesheet.json +++ b/erpnext/accounts/doctype/sales_invoice_timesheet/sales_invoice_timesheet.json @@ -16,9 +16,15 @@ "column_break_9", "billing_amount", "section_break_11", +<<<<<<< HEAD "timesheet_detail", "column_break_5", "time_sheet", +======= + "time_sheet", + "timesheet_detail", + "column_break_13", +>>>>>>> 09ccdee2db ( feat: add `total_billing_hours` to Sales Invoice (fp #26783) (#27742)) "project_name" ], "fields": [ @@ -91,7 +97,10 @@ "fieldtype": "Column Break" }, { +<<<<<<< HEAD +======= +>>>>>>> 09ccdee2db ( feat: add `total_billing_hours` to Sales Invoice (fp #26783) (#27742)) "fieldname": "section_break_7", "fieldtype": "Section Break", "label": "Totals" @@ -110,11 +119,19 @@ "fieldtype": "Data", "label": "Project Name", "read_only": 1 + }, + { + "fieldname": "column_break_13", + "fieldtype": "Column Break" } ], "istable": 1, "links": [], +<<<<<<< HEAD "modified": "2021-08-15 18:37:08.084930", +======= + "modified": "2021-10-02 03:48:44.979777", +>>>>>>> 09ccdee2db ( feat: add `total_billing_hours` to Sales Invoice (fp #26783) (#27742)) "modified_by": "Administrator", "module": "Accounts", "name": "Sales Invoice Timesheet", diff --git a/erpnext/projects/doctype/timesheet/timesheet.py b/erpnext/projects/doctype/timesheet/timesheet.py index 9155f45184fa..ea2d4a99e925 100644 --- a/erpnext/projects/doctype/timesheet/timesheet.py +++ b/erpnext/projects/doctype/timesheet/timesheet.py @@ -225,7 +225,10 @@ def get_projectwise_timesheet_data(project=None, parent=None, from_time=None, to query = f""" SELECT +<<<<<<< HEAD +======= +>>>>>>> 09ccdee2db ( feat: add `total_billing_hours` to Sales Invoice (fp #26783) (#27742)) tsd.name as name, tsd.parent as time_sheet, tsd.from_time as from_time, @@ -235,6 +238,7 @@ def get_projectwise_timesheet_data(project=None, parent=None, from_time=None, to tsd.activity_type as activity_type, tsd.description as description, ts.currency as currency, +<<<<<<< HEAD tsd.project_name as project_name FROM `tabTimesheet Detail` tsd @@ -244,12 +248,22 @@ def get_projectwise_timesheet_data(project=None, parent=None, from_time=None, to WHERE +======= + tsd.project_name as project_name + FROM `tabTimesheet Detail` tsd + INNER JOIN `tabTimesheet` ts + ON ts.name = tsd.parent + WHERE +>>>>>>> 09ccdee2db ( feat: add `total_billing_hours` to Sales Invoice (fp #26783) (#27742)) tsd.parenttype = 'Timesheet' AND tsd.docstatus = 1 AND tsd.is_billable = 1 AND tsd.sales_invoice is NULL {condition} +<<<<<<< HEAD +======= +>>>>>>> 09ccdee2db ( feat: add `total_billing_hours` to Sales Invoice (fp #26783) (#27742)) ORDER BY tsd.from_time ASC """