Skip to content

Commit

Permalink
fix: stock entry from item dashboard (stock levels)
Browse files Browse the repository at this point in the history
(cherry picked from commit dc0ddf8)
  • Loading branch information
s-aga-r authored and mergify[bot] committed Feb 5, 2023
1 parent 6df730c commit 04a474d
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions erpnext/stock/dashboard/item_dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ erpnext.stock.ItemDashboard = class ItemDashboard {
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);
Expand All @@ -63,11 +63,19 @@ erpnext.stock.ItemDashboard = class ItemDashboard {
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);
});
Expand Down

0 comments on commit 04a474d

Please sign in to comment.