Merge branch 'develop' into github-issue-33930
This commit is contained in:
commit
c7a540b7e2
@ -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 {
|
return {
|
||||||
query: "erpnext.controllers.queries.get_expense_account",
|
query: 'erpnext.controllers.queries.get_expense_account',
|
||||||
filters: { 'company': frm.doc.company }
|
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 => {
|
frappe.db.get_single_value('Buying Settings', 'backflush_raw_materials_of_subcontract_based_on').then(val => {
|
||||||
if (val == 'Material Transferred for Subcontract') {
|
if (val == 'Material Transferred for Subcontract') {
|
||||||
frm.fields_dict['supplied_items'].grid.grid_rows.forEach((grid_row) => {
|
frm.fields_dict['supplied_items'].grid.grid_rows.forEach((grid_row) => {
|
||||||
@ -73,7 +91,7 @@ frappe.ui.form.on('Subcontracting Receipt', {
|
|||||||
|
|
||||||
refresh: (frm) => {
|
refresh: (frm) => {
|
||||||
if (frm.doc.docstatus > 0) {
|
if (frm.doc.docstatus > 0) {
|
||||||
frm.add_custom_button(__("Stock Ledger"), function () {
|
frm.add_custom_button(__('Stock Ledger'), function () {
|
||||||
frappe.route_options = {
|
frappe.route_options = {
|
||||||
voucher_no: frm.doc.name,
|
voucher_no: frm.doc.name,
|
||||||
from_date: frm.doc.posting_date,
|
from_date: frm.doc.posting_date,
|
||||||
@ -81,8 +99,8 @@ frappe.ui.form.on('Subcontracting Receipt', {
|
|||||||
company: frm.doc.company,
|
company: frm.doc.company,
|
||||||
show_cancelled_entries: frm.doc.docstatus === 2
|
show_cancelled_entries: frm.doc.docstatus === 2
|
||||||
};
|
};
|
||||||
frappe.set_route("query-report", "Stock Ledger");
|
frappe.set_route('query-report', 'Stock Ledger');
|
||||||
}, __("View"));
|
}, __('View'));
|
||||||
|
|
||||||
frm.add_custom_button(__('Accounting Ledger'), function () {
|
frm.add_custom_button(__('Accounting Ledger'), function () {
|
||||||
frappe.route_options = {
|
frappe.route_options = {
|
||||||
@ -90,11 +108,11 @@ frappe.ui.form.on('Subcontracting Receipt', {
|
|||||||
from_date: frm.doc.posting_date,
|
from_date: frm.doc.posting_date,
|
||||||
to_date: moment(frm.doc.modified).format('YYYY-MM-DD'),
|
to_date: moment(frm.doc.modified).format('YYYY-MM-DD'),
|
||||||
company: frm.doc.company,
|
company: frm.doc.company,
|
||||||
group_by: "Group by Voucher (Consolidated)",
|
group_by: 'Group by Voucher (Consolidated)',
|
||||||
show_cancelled_entries: frm.doc.docstatus === 2
|
show_cancelled_entries: frm.doc.docstatus === 2
|
||||||
};
|
};
|
||||||
frappe.set_route("query-report", "General Ledger");
|
frappe.set_route('query-report', 'General Ledger');
|
||||||
}, __("View"));
|
}, __('View'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!frm.doc.is_return && frm.doc.docstatus == 1 && frm.doc.per_returned < 100) {
|
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 () {
|
frm.add_custom_button(__('Subcontracting Order'), function () {
|
||||||
if (!frm.doc.supplier) {
|
if (!frm.doc.supplier) {
|
||||||
frappe.throw({
|
frappe.throw({
|
||||||
title: __("Mandatory"),
|
title: __('Mandatory'),
|
||||||
message: __("Please Select a Supplier")
|
message: __('Please Select a Supplier')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
erpnext.utils.map_current_doc({
|
erpnext.utils.map_current_doc({
|
||||||
method: 'erpnext.subcontracting.doctype.subcontracting_order.subcontracting_order.make_subcontracting_receipt',
|
method: 'erpnext.subcontracting.doctype.subcontracting_order.subcontracting_order.make_subcontracting_receipt',
|
||||||
source_doctype: "Subcontracting Order",
|
source_doctype: 'Subcontracting Order',
|
||||||
target: frm,
|
target: frm,
|
||||||
setters: {
|
setters: {
|
||||||
supplier: frm.doc.supplier,
|
supplier: frm.doc.supplier,
|
||||||
},
|
},
|
||||||
get_query_filters: {
|
get_query_filters: {
|
||||||
docstatus: 1,
|
docstatus: 1,
|
||||||
per_received: ["<", 100],
|
per_received: ['<', 100],
|
||||||
company: frm.doc.company
|
company: frm.doc.company
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}, __("Get Items From"));
|
}, __('Get Items From'));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user