fix: Add multi currency check and proper account filters

This commit is contained in:
Deepesh Garg 2020-05-01 18:38:13 +05:30
parent db83c29079
commit 978de8779c
3 changed files with 23 additions and 6 deletions

View File

@ -173,7 +173,8 @@ frappe.ui.form.on("Journal Entry", {
"company": doc.company, "company": doc.company,
"voucher_type": doc.voucher_type, "voucher_type": doc.voucher_type,
"naming_series": doc.naming_series, "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); update_jv_details(frm.doc, doc.accounts);
}); });

View File

@ -4,13 +4,22 @@
frappe.ui.form.on("Journal Entry Template", { frappe.ui.form.on("Journal Entry Template", {
setup: function(frm) { setup: function(frm) {
frappe.model.set_default_values(frm.doc); frappe.model.set_default_values(frm.doc);
frm.set_query("account" ,"accounts", function(){ frm.set_query("account" ,"accounts", function(){
return { var filters = {
filters: { company: frm.doc.company,
"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({ frappe.call({
type: "GET", type: "GET",
method: "erpnext.accounts.doctype.journal_entry_template.journal_entry_template.get_naming_series", method: "erpnext.accounts.doctype.journal_entry_template.journal_entry_template.get_naming_series",

View File

@ -14,6 +14,7 @@
"column_break_3", "column_break_3",
"company", "company",
"is_opening", "is_opening",
"multi_currency",
"section_break_3", "section_break_3",
"accounts" "accounts"
], ],
@ -76,10 +77,16 @@
{ {
"fieldname": "section_break_3", "fieldname": "section_break_3",
"fieldtype": "Section Break" "fieldtype": "Section Break"
},
{
"default": "0",
"fieldname": "multi_currency",
"fieldtype": "Check",
"label": "Multi Currency"
} }
], ],
"links": [], "links": [],
"modified": "2020-04-29 10:52:33.526433", "modified": "2020-05-01 18:32:01.420488",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Journal Entry Template", "name": "Journal Entry Template",