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,
"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);
});

View File

@ -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",

View File

@ -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",