Stock acc bal sync msg (#19676)
* 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
* fix: make journal entry to sync stock and account balance
* fix: translated action label
diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js
index 6f43d9e..d5a78d4 100755
--- a/erpnext/public/js/utils.js
+++ b/erpnext/public/js/utils.js
@@ -74,6 +74,22 @@
);
});
},
+
+ 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);
+ });
+ }
});