Merge pull request #34080 from s-aga-r/batch-no-item
chore: copy `item_code` to `Batch` while creating new batch from SCR
This commit is contained in:
commit
0cd69c8700
@ -51,13 +51,31 @@ frappe.ui.form.on('Subcontracting Receipt', {
|
||||
}
|
||||
}));
|
||||
|
||||
frm.set_query("expense_account", "items", function () {
|
||||
frm.set_query('expense_account', 'items', function () {
|
||||
return {
|
||||
query: "erpnext.controllers.queries.get_expense_account",
|
||||
query: 'erpnext.controllers.queries.get_expense_account',
|
||||
filters: { 'company': frm.doc.company }
|
||||
};
|
||||
});
|
||||
|
||||
frm.set_query('batch_no', 'items', function(doc, cdt, cdn) {
|
||||
var row = locals[cdt][cdn];
|
||||
return {
|
||||
filters: {
|
||||
item: row.item_code
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
let batch_no_field = frm.get_docfield("items", "batch_no");
|
||||
if (batch_no_field) {
|
||||
batch_no_field.get_route_options_for_new_doc = function(row) {
|
||||
return {
|
||||
"item": row.doc.item_code
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
frappe.db.get_single_value('Buying Settings', 'backflush_raw_materials_of_subcontract_based_on').then(val => {
|
||||
if (val == 'Material Transferred for Subcontract') {
|
||||
frm.fields_dict['supplied_items'].grid.grid_rows.forEach((grid_row) => {
|
||||
@ -73,7 +91,7 @@ frappe.ui.form.on('Subcontracting Receipt', {
|
||||
|
||||
refresh: (frm) => {
|
||||
if (frm.doc.docstatus > 0) {
|
||||
frm.add_custom_button(__("Stock Ledger"), function () {
|
||||
frm.add_custom_button(__('Stock Ledger'), function () {
|
||||
frappe.route_options = {
|
||||
voucher_no: frm.doc.name,
|
||||
from_date: frm.doc.posting_date,
|
||||
@ -81,8 +99,8 @@ frappe.ui.form.on('Subcontracting Receipt', {
|
||||
company: frm.doc.company,
|
||||
show_cancelled_entries: frm.doc.docstatus === 2
|
||||
};
|
||||
frappe.set_route("query-report", "Stock Ledger");
|
||||
}, __("View"));
|
||||
frappe.set_route('query-report', 'Stock Ledger');
|
||||
}, __('View'));
|
||||
|
||||
frm.add_custom_button(__('Accounting Ledger'), function () {
|
||||
frappe.route_options = {
|
||||
@ -90,11 +108,11 @@ frappe.ui.form.on('Subcontracting Receipt', {
|
||||
from_date: frm.doc.posting_date,
|
||||
to_date: moment(frm.doc.modified).format('YYYY-MM-DD'),
|
||||
company: frm.doc.company,
|
||||
group_by: "Group by Voucher (Consolidated)",
|
||||
group_by: 'Group by Voucher (Consolidated)',
|
||||
show_cancelled_entries: frm.doc.docstatus === 2
|
||||
};
|
||||
frappe.set_route("query-report", "General Ledger");
|
||||
}, __("View"));
|
||||
frappe.set_route('query-report', 'General Ledger');
|
||||
}, __('View'));
|
||||
}
|
||||
|
||||
if (!frm.doc.is_return && frm.doc.docstatus == 1 && frm.doc.per_returned < 100) {
|
||||
@ -111,25 +129,25 @@ frappe.ui.form.on('Subcontracting Receipt', {
|
||||
frm.add_custom_button(__('Subcontracting Order'), function () {
|
||||
if (!frm.doc.supplier) {
|
||||
frappe.throw({
|
||||
title: __("Mandatory"),
|
||||
message: __("Please Select a Supplier")
|
||||
title: __('Mandatory'),
|
||||
message: __('Please Select a Supplier')
|
||||
});
|
||||
}
|
||||
|
||||
erpnext.utils.map_current_doc({
|
||||
method: 'erpnext.subcontracting.doctype.subcontracting_order.subcontracting_order.make_subcontracting_receipt',
|
||||
source_doctype: "Subcontracting Order",
|
||||
source_doctype: 'Subcontracting Order',
|
||||
target: frm,
|
||||
setters: {
|
||||
supplier: frm.doc.supplier,
|
||||
},
|
||||
get_query_filters: {
|
||||
docstatus: 1,
|
||||
per_received: ["<", 100],
|
||||
per_received: ['<', 100],
|
||||
company: frm.doc.company
|
||||
}
|
||||
});
|
||||
}, __("Get Items From"));
|
||||
}, __('Get Items From'));
|
||||
}
|
||||
},
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user