fix: Add multi currency check and proper account filters
diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.js b/erpnext/accounts/doctype/journal_entry/journal_entry.js
index ccfdfce..9a832e3 100644
--- a/erpnext/accounts/doctype/journal_entry/journal_entry.js
+++ b/erpnext/accounts/doctype/journal_entry/journal_entry.js
@@ -173,7 +173,8 @@
"company": doc.company,
"voucher_type": doc.voucher_type,
"naming_series": doc.naming_series,
- "is_opening": doc.is_opening
+ "is_opening": doc.is_opening,
+ "multi_currency": doc.multi_currency
})
update_jv_details(frm.doc, doc.accounts);
});
diff --git a/erpnext/accounts/doctype/journal_entry_template/journal_entry_template.js b/erpnext/accounts/doctype/journal_entry_template/journal_entry_template.js
index bcb3f3a..cbb9fc4 100644
--- a/erpnext/accounts/doctype/journal_entry_template/journal_entry_template.js
+++ b/erpnext/accounts/doctype/journal_entry_template/journal_entry_template.js
@@ -4,13 +4,22 @@
frappe.ui.form.on("Journal Entry Template", {
setup: function(frm) {
frappe.model.set_default_values(frm.doc);
+
frm.set_query("account" ,"accounts", function(){
- return {
- filters: {
- "company": frm.doc.company,
- }
+ var filters = {
+ company: frm.doc.company,
+ is_group: 0
};
+
+ if(!frm.doc.multi_currency) {
+ $.extend(filters, {
+ account_currency: frappe.get_doc(":Company", frm.doc.company).default_currency
+ });
+ }
+
+ return { filters: filters };
});
+
frappe.call({
type: "GET",
method: "erpnext.accounts.doctype.journal_entry_template.journal_entry_template.get_naming_series",
diff --git a/erpnext/accounts/doctype/journal_entry_template/journal_entry_template.json b/erpnext/accounts/doctype/journal_entry_template/journal_entry_template.json
index c411401..660ae85 100644
--- a/erpnext/accounts/doctype/journal_entry_template/journal_entry_template.json
+++ b/erpnext/accounts/doctype/journal_entry_template/journal_entry_template.json
@@ -14,6 +14,7 @@
"column_break_3",
"company",
"is_opening",
+ "multi_currency",
"section_break_3",
"accounts"
],
@@ -76,10 +77,16 @@
{
"fieldname": "section_break_3",
"fieldtype": "Section Break"
+ },
+ {
+ "default": "0",
+ "fieldname": "multi_currency",
+ "fieldtype": "Check",
+ "label": "Multi Currency"
}
],
"links": [],
- "modified": "2020-04-29 10:52:33.526433",
+ "modified": "2020-05-01 18:32:01.420488",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Journal Entry Template",