fix(report): field -> fieldname, dateutil -> frappe.datetime (#15106)
diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.html b/erpnext/accounts/report/accounts_receivable/accounts_receivable.html
index 9fefc037..09f3cc2 100644
--- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.html
+++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.html
@@ -34,7 +34,7 @@
<h5 class="text-center">
{%= __(filters.ageing_based_on) %}
{%= __("Until") %}
- {%= dateutil.str_to_user(filters.report_date) %}
+ {%= frappe.datetime.str_to_user(filters.report_date) %}
</h5>
<hr>
{% if(filters.show_pdc_in_print) { %}
@@ -138,7 +138,7 @@
<tr>
{% if(report.report_name === "Accounts Receivable" || report.report_name === "Accounts Payable") { %}
{% if(data[i][__("Customer")] || data[i][__("Supplier")]) { %}
- <td>{%= dateutil.str_to_user(data[i]["posting_date"]) %}</td>
+ <td>{%= frappe.datetime.str_to_user(data[i]["posting_date"]) %}</td>
<td>
{% if(!filters.show_pdc_in_print) { %}
{%= data[i]["voucher_type"] %}
@@ -220,7 +220,7 @@
<br> {%= data[i][__("Customer Name")] %}
{% } else if(data[i][__("Supplier Name")] != data[i][__("Supplier")]) { %}
<br> {%= data[i][__("Supplier Name")] %}
- {% } %}
+ {% } %}
{% } %}
<br>{%= __("Remarks") %}:
{%= data[i][__("Remarks")] %}
@@ -238,4 +238,4 @@
{% } %}
</tbody>
</table>
-<p class="text-right text-muted">{{ __("Printed On ") }}{%= dateutil.str_to_user(dateutil.get_datetime_as_string()) %}</p>
\ No newline at end of file
+<p class="text-right text-muted">{{ __("Printed On ") }}{%= frappe.datetime.str_to_user(frappe.datetime.get_datetime_as_string()) %}</p>
\ No newline at end of file
diff --git a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.html b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.html
index 23d2a31..eaabc90 100644
--- a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.html
+++ b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.html
@@ -18,17 +18,17 @@
{% for(var i=0, l=data.length; i<l; i++) { %}
{% if (data[i]["posting_date"]) { %}
<tr>
- <td>{%= dateutil.str_to_user(data[i]["posting_date"]) %}</td>
+ <td>{%= frappe.datetime.str_to_user(data[i]["posting_date"]) %}</td>
<td>{%= data[i]["payment_entry"] %}</td>
<td>{%= __("Against") %}: {%= data[i]["against_account"] %}
{% if (data[i]["reference_no"]) { %}
<br>{%= __("Reference") %}: {%= data[i]["reference_no"] %}
{% if (data[i]["ref_date"]) { %}
- <br>{%= __("Reference Date") %}: {%= dateutil.str_to_user(data[i]["ref_date"]) %}
+ <br>{%= __("Reference Date") %}: {%= frappe.datetime.str_to_user(data[i]["ref_date"]) %}
{% } %}
{% } %}
{% if (data[i]["clearance_date"]) { %}
- <br>{%= __("Clearance Date") %}: {%= dateutil.str_to_user(data[i]["clearance_date"]) %}
+ <br>{%= __("Clearance Date") %}: {%= frappe.datetime.str_to_user(data[i]["clearance_date"]) %}
{% } %}
</td>
<td style="text-align: right">{%= format_currency(data[i]["debit"]) %}</td>
@@ -46,4 +46,4 @@
{% } %}
</tbody>
</table>
-<p class="text-right text-muted">Printed On {%= dateutil.str_to_user(dateutil.get_datetime_as_string()) %}</p>
+<p class="text-right text-muted">Printed On {%= frappe.datetime.str_to_user(frappe.datetime.get_datetime_as_string()) %}</p>
diff --git a/erpnext/accounts/report/financial_statements.html b/erpnext/accounts/report/financial_statements.html
index e475a1c..4b3b5f2 100644
--- a/erpnext/accounts/report/financial_statements.html
+++ b/erpnext/accounts/report/financial_statements.html
@@ -51,7 +51,7 @@
</td>
{% for(var i=2, l=report_columns.length; i<l; i++) { %}
<td class="text-right">
- {% var fieldname = report_columns[i].field || report_columns[i].fieldname; %}
+ {% var fieldname = report_columns[i].fieldname; %}
{% if (!is_null(row[fieldname])) { %}
{%= format_currency(row[fieldname], filters.presentation_currency) %}
{% } %}
diff --git a/erpnext/buying/report/quoted_item_comparison/quoted_item_comparison.html b/erpnext/buying/report/quoted_item_comparison/quoted_item_comparison.html
index e26636e..098214d 100644
--- a/erpnext/buying/report/quoted_item_comparison/quoted_item_comparison.html
+++ b/erpnext/buying/report/quoted_item_comparison/quoted_item_comparison.html
@@ -1,10 +1,10 @@
<head>
-
-
+
+
<link href="/assets/frappe/css/c3.min.css" rel="stylesheet" type="text/css">
-
-
+
+
<script type="text/javascript" src="/assets/frappe/js/lib/d3.min.js"></script>
<script type="text/javascript" src="/assets/frappe/js/lib/c3.min.js"></script>
<script type="text/javascript">
@@ -13,12 +13,12 @@
var chartData = [];
{% var q = 0; %}
{% for(var j=0, m=data.length+1; j<m; j++) { %}
-
+
var tempData{%=j%} = [];
-
+
{% for(var i=1, l=report.columns.length; i<l; i++) { %}
{% if(__(report.columns[i].label) != __("Quotation")) { %}
-
+
{% if(j == 0) { %}
{% if(i == 1) { %}
tempData{%=j%}[{%=i%}-1] = \"x\";
@@ -28,14 +28,14 @@
{% } %}
{% } else { %}
{% if(i == 1) { %}
- tempData{%=j%}[{%=i%}-1] = \"{%= data[j-1][report.columns[i].field] %} \";
+ tempData{%=j%}[{%=i%}-1] = \"{%= data[j-1][report.columns[i].fieldname] %} \";
{% } else { %}
- tempData{%=j%}[{%=i%}-1] = {% if(data[j-1][report.columns[i].field] == "") { if (i > 2) { %}
- tempData{%=j%}[{%=i%}-2]
- {% } else { %}
- 0
- {% } } else { %}
- {%= data[j-1][report.columns[i].field] %}
+ tempData{%=j%}[{%=i%}-1] = {% if(data[j-1][report.columns[i].fieldname] == "") { if (i > 2) { %}
+ tempData{%=j%}[{%=i%}-2]
+ {% } else { %}
+ 0
+ {% } } else { %}
+ {%= data[j-1][report.columns[i].fieldname] %}
{% } %};
{% } %};
{% } %}
@@ -52,12 +52,12 @@
{% } %}
{% } %}
-
+
{% } %}
chartData[{%=j%}] = tempData{%=j%};
{% } %}
console.log(chartData);
-
+
hold = {
bindto: "#chart_div" ,data: {
x: "x",
@@ -81,7 +81,7 @@
console.log(hold);
var chart = c3.generate(hold);
});
-
+
function onReady(selector, callback) {
var intervalID = window.setInterval(function() {
if (document.querySelector(selector) !== undefined) {
@@ -89,8 +89,8 @@
callback.call(this);
}
}, 500);}
-
-
+
+
</script>
</head>
@@ -114,9 +114,9 @@
{% for(var i=0, l=data.length; i<l; i++) { %}
<tr>
-
+
{% for(var j=0,m=report.columns.length; j<m; j++) { %}
- <td style="width: 15%">{%= data[i][report.columns[j].field] %}</td>
+ <td style="width: 15%">{%= data[i][report.columns[j].fieldname] %}</td>
{% } %}
</tr>
@@ -128,5 +128,5 @@
<div id="chart_div"></div>
-
-<p class="text-right text-muted">Printed On {%= dateutil.str_to_user(dateutil.get_datetime_as_string()) %}</p>
\ No newline at end of file
+
+<p class="text-right text-muted">Printed On {%= frappe.datetime.str_to_user(frappe.datetime.get_datetime_as_string()) %}</p>
\ No newline at end of file
diff --git a/erpnext/education/report/course_wise_assessment_report/course_wise_assessment_report.html b/erpnext/education/report/course_wise_assessment_report/course_wise_assessment_report.html
index e2df273..33e725f 100644
--- a/erpnext/education/report/course_wise_assessment_report/course_wise_assessment_report.html
+++ b/erpnext/education/report/course_wise_assessment_report/course_wise_assessment_report.html
@@ -36,7 +36,7 @@
<tr>
{% for(var i=1, l=report_columns.length; i<l; i++) { %}
<td class="text-center">
- {% var fieldname = report_columns[i].field; %}
+ {% var fieldname = report_columns[i].fieldname; %}
{% if (!is_null(row[fieldname])) { %}
{%= row[fieldname] %}
{% } %}
@@ -47,4 +47,4 @@
</tbody>
</table>
-<p class="text-right text-muted">Printed On {%= dateutil.str_to_user(dateutil.get_datetime_as_string()) %}</p>
+<p class="text-right text-muted">Printed On {%= frappe.datetime.str_to_user(frappe.datetime.get_datetime_as_string()) %}</p>
diff --git a/erpnext/healthcare/page/medical_record/medical_record_row.html b/erpnext/healthcare/page/medical_record/medical_record_row.html
index 6b79146..9a670c9 100644
--- a/erpnext/healthcare/page/medical_record/medical_record_row.html
+++ b/erpnext/healthcare/page/medical_record/medical_record_row.html
@@ -5,7 +5,7 @@
<div class="col-xs-9 medical_record-message"
data-doctype="{%= reference_doctype %}"
data-docname="{%= reference_name %}"
- title="{%= by %} / {%= dateutil.str_to_user(creation) %}">
+ title="{%= by %} / {%= frappe.datetime.str_to_user(creation) %}">
<span class="avatar avatar-small">
<div class="avatar-frame" style="background-image: url({{ imgsrc }});"></div>
<!-- <img src="{%= imgsrc %}"> -->
diff --git a/erpnext/hr/page/team_updates/team_update_row.html b/erpnext/hr/page/team_updates/team_update_row.html
index e3adcb8..4f36754 100644
--- a/erpnext/hr/page/team_updates/team_update_row.html
+++ b/erpnext/hr/page/team_updates/team_update_row.html
@@ -2,7 +2,7 @@
<div class="col-xs-3 text-right activity-date"><span class="{%= date_class %}">
{%= date_sep || "" %}</span></div>
<div class="col-xs-9 activity-message"
- title="{%= by %} / {%= dateutil.str_to_user(creation) %}">
+ title="{%= by %} / {%= frappe.datetime.str_to_user(creation) %}">
<div class="row">
<div class="col-xs-2 col-sm-1">
{{ avatar }}
diff --git a/erpnext/hr/report/salary_register/salary_register.html b/erpnext/hr/report/salary_register/salary_register.html
index a322bd4..3abc3a0 100644
--- a/erpnext/hr/report/salary_register/salary_register.html
+++ b/erpnext/hr/report/salary_register/salary_register.html
@@ -2,7 +2,7 @@
var report_columns = report.get_columns_for_print();
%}
<div style="margin-bottom: 7px;" class="text-center">
- {%= frappe.boot.letter_heads[filters.letter_head || frappe.defaults.get_default("letter_head")] %}
+ {%= frappe.boot.letter_heads[filters.letter_head || frappe.defaults.get_default("letter_head")].header %}
</div>
<h2 class="text-center">{%= __(report.report_name) %}</h2>
<h5 class="text-center">{{ __("From") }} {%= filters.from_date %} {{ __("to") }} {%= filters.to_date %}</h5>
@@ -23,7 +23,7 @@
<tr>
{% for(var i=1, l=report_columns.length; i<l; i++) { %}
<td class="text-right">
- {% var fieldname = report_columns[i].field; %}
+ {% var fieldname = report_columns[i].fieldname; %}
{% if (report_columns[i].fieldtype=='Currency' && !isNaN(row[fieldname])) { %}
{%= format_currency(row[fieldname]) %}
{% } else { %}
@@ -37,4 +37,4 @@
{% } %}
</tbody>
</table>
-<p class="text-right text-muted">{{ __("Printed On") }} {%= dateutil.str_to_user(dateutil.get_datetime_as_string()) %}</p>
+<p class="text-right text-muted">{{ __("Printed On") }} {%= frappe.datetime.str_to_user(frappe.datetime.get_datetime_as_string()) %}</p>