Merge pull request #37860 from ruthra-kumar/filter_disable_accounts
refactor: ignore disabled account while selecting Income Accounts
This commit is contained in:
commit
3502c01aa4
@ -187,7 +187,6 @@ erpnext.accounts.SalesInvoiceController = class SalesInvoiceController extends e
|
|||||||
erpnext.accounts.unreconcile_payments.add_unreconcile_btn(me.frm);
|
erpnext.accounts.unreconcile_payments.add_unreconcile_btn(me.frm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
make_maintenance_schedule() {
|
make_maintenance_schedule() {
|
||||||
frappe.model.open_mapped_doc({
|
frappe.model.open_mapped_doc({
|
||||||
method: "erpnext.accounts.doctype.sales_invoice.sales_invoice.make_maintenance_schedule",
|
method: "erpnext.accounts.doctype.sales_invoice.sales_invoice.make_maintenance_schedule",
|
||||||
@ -563,15 +562,6 @@ cur_frm.fields_dict.write_off_cost_center.get_query = function(doc) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Income Account in Details Table
|
|
||||||
// --------------------------------
|
|
||||||
cur_frm.set_query("income_account", "items", function(doc) {
|
|
||||||
return{
|
|
||||||
query: "erpnext.controllers.queries.get_income_account",
|
|
||||||
filters: {'company': doc.company}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Cost Center in Details Table
|
// Cost Center in Details Table
|
||||||
// -----------------------------
|
// -----------------------------
|
||||||
cur_frm.fields_dict["items"].grid.get_field("cost_center").get_query = function(doc) {
|
cur_frm.fields_dict["items"].grid.get_field("cost_center").get_query = function(doc) {
|
||||||
@ -666,6 +656,16 @@ frappe.ui.form.on('Sales Invoice', {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
frm.set_query("income_account", "items", function() {
|
||||||
|
return{
|
||||||
|
query: "erpnext.controllers.queries.get_income_account",
|
||||||
|
filters: {
|
||||||
|
'company': frm.doc.company,
|
||||||
|
"disabled": 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
frm.custom_make_buttons = {
|
frm.custom_make_buttons = {
|
||||||
'Delivery Note': 'Delivery',
|
'Delivery Note': 'Delivery',
|
||||||
'Sales Invoice': 'Return / Credit Note',
|
'Sales Invoice': 'Return / Credit Note',
|
||||||
|
@ -611,6 +611,8 @@ def get_income_account(doctype, txt, searchfield, start, page_len, filters):
|
|||||||
if filters.get("company"):
|
if filters.get("company"):
|
||||||
condition += "and tabAccount.company = %(company)s"
|
condition += "and tabAccount.company = %(company)s"
|
||||||
|
|
||||||
|
condition += f"and tabAccount.disabled = {filters.get('disabled', 0)}"
|
||||||
|
|
||||||
return frappe.db.sql(
|
return frappe.db.sql(
|
||||||
"""select tabAccount.name from `tabAccount`
|
"""select tabAccount.name from `tabAccount`
|
||||||
where (tabAccount.report_type = "Profit and Loss"
|
where (tabAccount.report_type = "Profit and Loss"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user