fix: multiple fixes to timesheets (#27775)

This commit is contained in:
Sagar Vora
2021-10-04 17:08:50 +05:30
committed by GitHub
parent 21a5498d5d
commit e17713c9d6
4 changed files with 27 additions and 29 deletions

View File

@@ -446,12 +446,15 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
}, },
currency() { currency() {
var me = this;
this._super(); this._super();
$.each(cur_frm.doc.timesheets, function(i, d) { if (this.frm.doc.timesheets) {
let row = frappe.get_doc(d.doctype, d.name) this.frm.doc.timesheets.forEach((d) => {
set_timesheet_detail_rate(row.doctype, row.name, cur_frm.doc.currency, row.timesheet_detail) let row = frappe.get_doc(d.doctype, d.name)
}); set_timesheet_detail_rate(row.doctype, row.name, me.frm.doc.currency, row.timesheet_detail)
calculate_total_billing_amount(cur_frm) });
frm.trigger("calculate_timesheet_totals");
}
} }
}); });
@@ -999,7 +1002,7 @@ frappe.ui.form.on('Sales Invoice', {
frappe.ui.form.on("Sales Invoice Timesheet", { frappe.ui.form.on("Sales Invoice Timesheet", {
timesheets_remove(frm, cdt, cdn) { timesheets_remove(frm) {
frm.trigger("calculate_timesheet_totals"); frm.trigger("calculate_timesheet_totals");
} }
}); });

View File

@@ -1990,16 +1990,6 @@
"label": "Additional Discount Account", "label": "Additional Discount Account",
"options": "Account" "options": "Account"
}, },
{
"default": "0",
"fieldname": "ignore_default_payment_terms_template",
"fieldtype": "Check",
"hidden": 1,
"label": "Ignore Default Payment Terms Template",
"read_only": 1,
"show_days": 1,
"show_seconds": 1
},
{ {
"allow_on_submit": 1, "allow_on_submit": 1,
"fieldname": "dispatch_address_name", "fieldname": "dispatch_address_name",
@@ -2015,6 +2005,14 @@
"label": "Dispatch Address", "label": "Dispatch Address",
"read_only": 1 "read_only": 1
}, },
{
"default": "0",
"fieldname": "ignore_default_payment_terms_template",
"fieldtype": "Check",
"hidden": 1,
"label": "Ignore Default Payment Terms Template",
"read_only": 1
},
{ {
"fieldname": "total_billing_hours", "fieldname": "total_billing_hours",
"fieldtype": "Float", "fieldtype": "Float",
@@ -2033,7 +2031,7 @@
"link_fieldname": "consolidated_invoice" "link_fieldname": "consolidated_invoice"
} }
], ],
"modified": "2021-09-28 13:09:34.391799", "modified": "2021-10-02 03:36:10.251715",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Sales Invoice", "name": "Sales Invoice",

View File

@@ -16,9 +16,9 @@
"column_break_9", "column_break_9",
"billing_amount", "billing_amount",
"section_break_11", "section_break_11",
"timesheet_detail",
"column_break_5",
"time_sheet", "time_sheet",
"timesheet_detail",
"column_break_13",
"project_name" "project_name"
], ],
"fields": [ "fields": [
@@ -91,7 +91,6 @@
"fieldtype": "Column Break" "fieldtype": "Column Break"
}, },
{ {
"fieldname": "section_break_7", "fieldname": "section_break_7",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Totals" "label": "Totals"
@@ -110,11 +109,15 @@
"fieldtype": "Data", "fieldtype": "Data",
"label": "Project Name", "label": "Project Name",
"read_only": 1 "read_only": 1
},
{
"fieldname": "column_break_13",
"fieldtype": "Column Break"
} }
], ],
"istable": 1, "istable": 1,
"links": [], "links": [],
"modified": "2021-08-15 18:37:08.084930", "modified": "2021-10-02 03:48:44.979777",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Sales Invoice Timesheet", "name": "Sales Invoice Timesheet",

View File

@@ -225,7 +225,6 @@ def get_projectwise_timesheet_data(project=None, parent=None, from_time=None, to
query = f""" query = f"""
SELECT SELECT
tsd.name as name, tsd.name as name,
tsd.parent as time_sheet, tsd.parent as time_sheet,
tsd.from_time as from_time, tsd.from_time as from_time,
@@ -235,21 +234,16 @@ def get_projectwise_timesheet_data(project=None, parent=None, from_time=None, to
tsd.activity_type as activity_type, tsd.activity_type as activity_type,
tsd.description as description, tsd.description as description,
ts.currency as currency, ts.currency as currency,
tsd.project_name as project_name tsd.project_name as project_name
FROM `tabTimesheet Detail` tsd FROM `tabTimesheet Detail` tsd
INNER JOIN `tabTimesheet` ts INNER JOIN `tabTimesheet` ts
ON ts.name = tsd.parent ON ts.name = tsd.parent
WHERE WHERE
tsd.parenttype = 'Timesheet' tsd.parenttype = 'Timesheet'
AND tsd.docstatus = 1 AND tsd.docstatus = 1
AND tsd.is_billable = 1 AND tsd.is_billable = 1
AND tsd.sales_invoice is NULL AND tsd.sales_invoice is NULL
{condition} {condition}
ORDER BY tsd.from_time ASC ORDER BY tsd.from_time ASC
""" """