fix: Prefilled JV via Account Balance and Stock Value mismatch error message

- Make JV button will route to Journal Entry and add rows in child table
This commit is contained in:
marination
2019-11-18 15:55:32 +05:30
parent 87c6718d90
commit 6ef057a2a3
2 changed files with 39 additions and 10 deletions

View File

@@ -64,7 +64,7 @@ frappe.ui.form.on(cur_frm.doctype, {
}
})
}
}
}
});
frappe.ui.form.on('Sales Invoice Payment', {
@@ -356,3 +356,19 @@ cur_frm.pformat.taxes= function(doc){
}
return out;
}
erpnext.route_to_adjustment_jv = (args) => {
frappe.model.with_doctype('Journal Entry', () => {
// route to adjustment Journal Entry to handle Account Balance and Stock Value mismatch
let journal_entry = frappe.model.get_new_doc('Journal Entry');
args.accounts.forEach((je_account) => {
let child_row = frappe.model.add_child(journal_entry, "accounts");
child_row.account = je_account.account;
child_row.debit_in_account_currency = je_account.debit_in_account_currency;
child_row.credit_in_account_currency = je_account.credit_in_account_currency;
child_row.party_type = "" ;
});
frappe.set_route('Form','Journal Entry', journal_entry.name);
});
}