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
diff --git a/erpnext/public/js/controllers/accounts.js b/erpnext/public/js/controllers/accounts.js
index 3dfc891..eb99192 100644
--- a/erpnext/public/js/controllers/accounts.js
+++ b/erpnext/public/js/controllers/accounts.js
@@ -64,7 +64,7 @@
}
})
}
- }
+ }
});
frappe.ui.form.on('Sales Invoice Payment', {
@@ -356,3 +356,19 @@
}
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);
+ });
+}
\ No newline at end of file