fix: make journal entry to sync stock and account balance

This commit is contained in:
Nabin Hait
2019-11-25 12:33:40 +05:30
parent aff4a67954
commit 1ed1c4e6a4
3 changed files with 21 additions and 18 deletions

View File

@@ -74,6 +74,22 @@ $.extend(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);
});
}
});