[fixes] set default values to cheque print and set background image only if attachment exist
diff --git a/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.js b/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.js
index dea3af6..6a430eb 100644
--- a/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.js
+++ b/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.js
@@ -17,7 +17,6 @@
var template = '<div style="position: relative; overflow-x: scroll;">\
<div id="cheque_preview" style="width: {{ cheque_width }}cm; \
height: {{ cheque_height }}cm;\
- background-image: url({{ scanned_cheque }});\
background-repeat: no-repeat;\
background-size: cover;">\
<span style="top: {{ acc_pay_dist_from_top_edge }}cm;\
@@ -50,6 +49,10 @@
</div>';
$(frappe.render(template, frm.doc)).appendTo(frm.fields_dict.cheque_print_preview.wrapper)
+
+ if (frm.doc.scanned_cheque) {
+ $(frm.fields_dict.cheque_print_preview.wrapper).find("#cheque_preview").css('background-image', 'url(' + frm.doc.scanned_cheque + ')');
+ }
}
}
});
diff --git a/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.json b/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.json
index 9cec920..51da9c0 100644
--- a/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.json
+++ b/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.json
@@ -116,6 +116,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "default": "Regular",
"fieldname": "cheque_size",
"fieldtype": "Select",
"hidden": 0,
@@ -168,6 +169,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "default": "20.00",
"fieldname": "cheque_width",
"fieldtype": "Float",
"hidden": 0,
@@ -193,6 +195,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "default": "9.00",
"fieldname": "cheque_height",
"fieldtype": "Float",
"hidden": 0,
@@ -218,6 +221,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "default": "",
"fieldname": "scanned_cheque",
"fieldtype": "Attach",
"hidden": 0,
@@ -267,6 +271,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "default": "1",
"fieldname": "is_account_payable",
"fieldtype": "Check",
"hidden": 0,
@@ -292,6 +297,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "default": "1.00",
"depends_on": "eval:doc.is_account_payable",
"fieldname": "acc_pay_dist_from_top_edge",
"fieldtype": "Float",
@@ -318,6 +324,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "default": "9.00",
"depends_on": "eval:doc.is_account_payable",
"fieldname": "acc_pay_dist_from_left_edge",
"fieldtype": "Float",
@@ -344,6 +351,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "default": "Acc. Payee",
"depends_on": "eval:doc.is_account_payable",
"fieldname": "message_to_show",
"fieldtype": "Data",
@@ -421,6 +429,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "default": "1.00",
"fieldname": "date_dist_from_top_edge",
"fieldtype": "Float",
"hidden": 0,
@@ -446,6 +455,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "default": "15.00",
"depends_on": "",
"fieldname": "date_dist_from_left_edge",
"fieldtype": "Float",
@@ -497,6 +507,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "default": "2.00",
"fieldname": "payer_name_from_top_edge",
"fieldtype": "Float",
"hidden": 0,
@@ -522,6 +533,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "default": "3.00",
"fieldname": "payer_name_from_left_edge",
"fieldtype": "Float",
"hidden": 0,
@@ -597,6 +609,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "default": "3.00",
"fieldname": "amt_in_words_from_top_edge",
"fieldtype": "Float",
"hidden": 0,
@@ -622,6 +635,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "default": "4.00",
"fieldname": "amt_in_words_from_left_edge",
"fieldtype": "Float",
"hidden": 0,
@@ -647,6 +661,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "default": "15.00",
"fieldname": "amt_in_word_width",
"fieldtype": "Float",
"hidden": 0,
@@ -672,6 +687,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "default": "0.50",
"fieldname": "amt_in_words_line_spacing",
"fieldtype": "Float",
"hidden": 0,
@@ -722,6 +738,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "default": "3.50",
"fieldname": "amt_in_figures_from_top_edge",
"fieldtype": "Float",
"hidden": 0,
@@ -747,6 +764,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "default": "16.00",
"fieldname": "amt_in_figures_from_left_edge",
"fieldtype": "Float",
"hidden": 0,
@@ -822,6 +840,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "default": "5.00",
"fieldname": "acc_no_dist_from_top_edge",
"fieldtype": "Float",
"hidden": 0,
@@ -847,6 +866,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "default": "4.00",
"fieldname": "acc_no_dist_from_left_edge",
"fieldtype": "Float",
"hidden": 0,
@@ -897,6 +917,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "default": "6.00",
"fieldname": "signatory_from_top_edge",
"fieldtype": "Float",
"hidden": 0,
@@ -922,6 +943,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "default": "15.00",
"fieldname": "signatory_from_left_edge",
"fieldtype": "Float",
"hidden": 0,
@@ -996,13 +1018,14 @@
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 0,
+ "image_view": 0,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"max_attachments": 1,
- "modified": "2016-05-19 13:30:26.754096",
+ "modified": "2016-06-23 20:19:11.694932",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Cheque Print Template",