Merge pull request #33942 from s-aga-r/github-issue-33533
fix: stock entry from item dashboard (stock levels)
diff --git a/erpnext/stock/dashboard/item_dashboard.js b/erpnext/stock/dashboard/item_dashboard.js
index 1be528f..b09b715 100644
--- a/erpnext/stock/dashboard/item_dashboard.js
+++ b/erpnext/stock/dashboard/item_dashboard.js
@@ -42,7 +42,7 @@
let warehouse = unescape(element.attr('data-warehouse'));
let actual_qty = unescape(element.attr('data-actual_qty'));
let disable_quick_entry = Number(unescape(element.attr('data-disable_quick_entry')));
- let entry_type = action === "Move" ? "Material Transfer" : null;
+ let entry_type = action === "Move" ? "Material Transfer" : "Material Receipt";
if (disable_quick_entry) {
open_stock_entry(item, warehouse, entry_type);
@@ -63,11 +63,19 @@
function open_stock_entry(item, warehouse, entry_type) {
frappe.model.with_doctype('Stock Entry', function () {
var doc = frappe.model.get_new_doc('Stock Entry');
- if (entry_type) doc.stock_entry_type = entry_type;
+ if (entry_type) {
+ doc.stock_entry_type = entry_type;
+ }
var row = frappe.model.add_child(doc, 'items');
row.item_code = item;
- row.s_warehouse = warehouse;
+
+ if (entry_type === "Material Transfer") {
+ row.s_warehouse = warehouse;
+ }
+ else {
+ row.t_warehouse = warehouse;
+ }
frappe.set_route('Form', doc.doctype, doc.name);
});