refactor(minor): subcontracting_receipt.js
This commit is contained in:
parent
1504ff8b6c
commit
c8d7433e30
@ -52,14 +52,14 @@ frappe.ui.form.on('Subcontracting Receipt', {
|
|||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
frm.set_query('expense_account', 'items', function () {
|
frm.set_query('expense_account', 'items', () => {
|
||||||
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) {
|
frm.set_query('batch_no', 'items', (doc, cdt, cdn) => {
|
||||||
var row = locals[cdt][cdn];
|
var row = locals[cdt][cdn];
|
||||||
return {
|
return {
|
||||||
filters: {
|
filters: {
|
||||||
@ -68,7 +68,7 @@ frappe.ui.form.on('Subcontracting Receipt', {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
frm.set_query('batch_no', 'supplied_items', function(doc, cdt, cdn) {
|
frm.set_query('batch_no', 'supplied_items', (doc, cdt, cdn) => {
|
||||||
var row = locals[cdt][cdn];
|
var row = locals[cdt][cdn];
|
||||||
return {
|
return {
|
||||||
filters: {
|
filters: {
|
||||||
@ -101,7 +101,7 @@ frappe.ui.form.on('Subcontracting Receipt', {
|
|||||||
|
|
||||||
let batch_no_field = frm.get_docfield('items', 'batch_no');
|
let batch_no_field = frm.get_docfield('items', 'batch_no');
|
||||||
if (batch_no_field) {
|
if (batch_no_field) {
|
||||||
batch_no_field.get_route_options_for_new_doc = function(row) {
|
batch_no_field.get_route_options_for_new_doc = (row) => {
|
||||||
return {
|
return {
|
||||||
'item': row.doc.item_code
|
'item': row.doc.item_code
|
||||||
}
|
}
|
||||||
@ -111,7 +111,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'), () => {
|
||||||
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,
|
||||||
@ -122,7 +122,7 @@ frappe.ui.form.on('Subcontracting Receipt', {
|
|||||||
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'), () => {
|
||||||
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,
|
||||||
@ -136,7 +136,7 @@ frappe.ui.form.on('Subcontracting Receipt', {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
||||||
frm.add_custom_button(__('Subcontract Return'), function () {
|
frm.add_custom_button(__('Subcontract Return'), () => {
|
||||||
frappe.model.open_mapped_doc({
|
frappe.model.open_mapped_doc({
|
||||||
method: 'erpnext.subcontracting.doctype.subcontracting_receipt.subcontracting_receipt.make_subcontract_return',
|
method: 'erpnext.subcontracting.doctype.subcontracting_receipt.subcontracting_receipt.make_subcontract_return',
|
||||||
frm: frm
|
frm: frm
|
||||||
@ -146,7 +146,7 @@ frappe.ui.form.on('Subcontracting Receipt', {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (frm.doc.docstatus == 0) {
|
if (frm.doc.docstatus == 0) {
|
||||||
frm.add_custom_button(__('Subcontracting Order'), function () {
|
frm.add_custom_button(__('Subcontracting Order'), () => {
|
||||||
if (!frm.doc.supplier) {
|
if (!frm.doc.supplier) {
|
||||||
frappe.throw({
|
frappe.throw({
|
||||||
title: __('Mandatory'),
|
title: __('Mandatory'),
|
||||||
@ -200,16 +200,16 @@ frappe.ui.form.on('Subcontracting Receipt', {
|
|||||||
});
|
});
|
||||||
|
|
||||||
frappe.ui.form.on('Landed Cost Taxes and Charges', {
|
frappe.ui.form.on('Landed Cost Taxes and Charges', {
|
||||||
amount: function (frm, cdt, cdn) {
|
amount: (frm, cdt, cdn) => {
|
||||||
set_missing_values(frm);
|
set_missing_values(frm);
|
||||||
frm.events.set_base_amount(frm, cdt, cdn);
|
frm.events.set_base_amount(frm, cdt, cdn);
|
||||||
},
|
},
|
||||||
|
|
||||||
expense_account: function (frm, cdt, cdn) {
|
expense_account: (frm, cdt, cdn) => {
|
||||||
frm.events.set_account_currency(frm, cdt, cdn);
|
frm.events.set_account_currency(frm, cdt, cdn);
|
||||||
},
|
},
|
||||||
|
|
||||||
additional_costs_remove: function(frm) {
|
additional_costs_remove: (frm) => {
|
||||||
set_missing_values(frm);
|
set_missing_values(frm);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -233,7 +233,7 @@ frappe.ui.form.on('Subcontracting Receipt Item', {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
items_remove: function(frm) {
|
items_remove: (frm) => {
|
||||||
set_missing_values(frm);
|
set_missing_values(frm);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user