I’ve New Stock Entry Form. In Item Dropdown List, I only want to show Item Code and Item Name.
for reference, I’ve attached Screen Shot
great!
@Rahul-R… How can we show stock of item available in deferent warehouses, while selecting item in doctype/sales invoice etc.?
We have been using some client script to view the warehouse wise stock by pressing a short key cntrl +q.
Paste the below code in the client script of the document which you required and change the child table name accordingly.
frappe.ui.keys.add_shortcut({
shortcut: 'ctrl+q',
action: () => {
const current_doc = $('.data-row.editable-row').parent().attr("data-name");
const item_row = locals["Sales Order Item"][current_doc];
frappe.call({
method: 'erpnext.stock.dashboard.item_dashboard.get_data',
args: {
item_code: item_row.item_code,
},
callback: function(r) {
if (r.message.length > 0){
const d = new frappe.ui.Dialog({
title: __('Item Balance'),
width: 400
});
$(`<div class="modal-body ui-front">
<h2>${item_row.item_code}</h2>
<h2> <img style="width:120px"; src= ${item_row.image}/></h2>
<p>${item_row.description}</p>
<table class="table table-bordered">
<thead>
<tr>
<th>Check</th>
<th>Warehouse</th>
<th>Qty</th>
<th>UOM</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>`).appendTo(d.body);
r.message.forEach(element => {
const tbody = $(d.body).find('tbody');
const tr = $(`
<tr>
<td><input type="checkbox" class="check-warehouse" data-warehouse="${element.warehouse}"></td>
<td>${element.warehouse}</td>
<td>${element.actual_qty}</td>
<td>${item_row.stock_uom }</td>
</tr>
`).appendTo(tbody)
tbody.find('.check-warehouse').on('change', function() {
$('input.check-warehouse').not(this).prop('checked', false);
});
});
d.set_primary_action("Select", function() {
$(d.body).find('input:checked').each(function(i, input) {
frappe.model.set_value(item_row.doctype, item_row.name, 'warehouse', $(input).attr('data-warehouse'));
});
cur_frm.rec_dialog.hide();
cur_frm.refresh_fields();
});
cur_frm.rec_dialog = d;
d.show();
}
}
});
},
page: this.page,
description: __('Get Item INFO'),
ignore_inputs: true,
});
1 Like