mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-29 09:54:47 +00:00
Merge pull request #39514 from barredterra/refactor-batch-v14
This commit is contained in:
@@ -52,7 +52,7 @@ frappe.ui.form.on('Batch', {
|
|||||||
// sort by qty
|
// sort by qty
|
||||||
r.message.sort(function(a, b) { a.qty > b.qty ? 1 : -1 });
|
r.message.sort(function(a, b) { a.qty > b.qty ? 1 : -1 });
|
||||||
|
|
||||||
var rows = $('<div></div>').appendTo(section);
|
const rows = $('<div></div>').appendTo(section);
|
||||||
|
|
||||||
// show
|
// show
|
||||||
(r.message || []).forEach(function(d) {
|
(r.message || []).forEach(function(d) {
|
||||||
@@ -76,7 +76,7 @@ frappe.ui.form.on('Batch', {
|
|||||||
|
|
||||||
// move - ask for target warehouse and make stock entry
|
// move - ask for target warehouse and make stock entry
|
||||||
rows.find('.btn-move').on('click', function() {
|
rows.find('.btn-move').on('click', function() {
|
||||||
var $btn = $(this);
|
const $btn = $(this);
|
||||||
const fields = [
|
const fields = [
|
||||||
{
|
{
|
||||||
fieldname: 'to_warehouse',
|
fieldname: 'to_warehouse',
|
||||||
@@ -115,7 +115,7 @@ frappe.ui.form.on('Batch', {
|
|||||||
// split - ask for new qty and batch ID (optional)
|
// split - ask for new qty and batch ID (optional)
|
||||||
// and make stock entry via batch.batch_split
|
// and make stock entry via batch.batch_split
|
||||||
rows.find('.btn-split').on('click', function() {
|
rows.find('.btn-split').on('click', function() {
|
||||||
var $btn = $(this);
|
const $btn = $(this);
|
||||||
frappe.prompt([{
|
frappe.prompt([{
|
||||||
fieldname: 'qty',
|
fieldname: 'qty',
|
||||||
label: __('New Batch Qty'),
|
label: __('New Batch Qty'),
|
||||||
@@ -128,19 +128,16 @@ frappe.ui.form.on('Batch', {
|
|||||||
fieldtype: 'Data',
|
fieldtype: 'Data',
|
||||||
}],
|
}],
|
||||||
(data) => {
|
(data) => {
|
||||||
frappe.call({
|
frappe.xcall(
|
||||||
method: 'erpnext.stock.doctype.batch.batch.split_batch',
|
'erpnext.stock.doctype.batch.batch.split_batch',
|
||||||
args: {
|
{
|
||||||
item_code: frm.doc.item,
|
item_code: frm.doc.item,
|
||||||
batch_no: frm.doc.name,
|
batch_no: frm.doc.name,
|
||||||
qty: data.qty,
|
qty: data.qty,
|
||||||
warehouse: $btn.attr('data-warehouse'),
|
warehouse: $btn.attr('data-warehouse'),
|
||||||
new_batch_id: data.new_batch_id
|
new_batch_id: data.new_batch_id
|
||||||
},
|
}
|
||||||
callback: (r) => {
|
).then(() => frm.reload_doc());
|
||||||
frm.refresh();
|
|
||||||
},
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
__('Split Batch'),
|
__('Split Batch'),
|
||||||
__('Split')
|
__('Split')
|
||||||
|
|||||||
Reference in New Issue
Block a user