mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-01 19:29:10 +00:00
fix: query for against types
This commit is contained in:
@@ -220,6 +220,16 @@ erpnext.accounts.JournalEntry = class JournalEntry extends frappe.ui.form.Contro
|
|||||||
return erpnext.journal_entry.account_query(me.frm);
|
return erpnext.journal_entry.account_query(me.frm);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
me.frm.set_query("against_account_link", "accounts", function(doc, cdt, cdn) {
|
||||||
|
return erpnext.journal_entry.against_account_query(me.frm);
|
||||||
|
});
|
||||||
|
|
||||||
|
me.frm.set_query("against_type", "accounts", function(){
|
||||||
|
return {
|
||||||
|
query: "erpnext.accounts.doctype.journal_entry.journal_entry.get_against_type",
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
me.frm.set_query("party_type", "accounts", function(doc, cdt, cdn) {
|
me.frm.set_query("party_type", "accounts", function(doc, cdt, cdn) {
|
||||||
const row = locals[cdt][cdn];
|
const row = locals[cdt][cdn];
|
||||||
|
|
||||||
@@ -591,6 +601,21 @@ $.extend(erpnext.journal_entry, {
|
|||||||
return { filters: filters };
|
return { filters: filters };
|
||||||
},
|
},
|
||||||
|
|
||||||
|
against_account_query: function(frm) {
|
||||||
|
if (frm.doc.against_type != "Account"){
|
||||||
|
return { filters: {} };
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
let filters = { company: frm.doc.company, is_group: 0 };
|
||||||
|
if(!frm.doc.multi_currency) {
|
||||||
|
$.extend(filters, {
|
||||||
|
account_currency: ['in', [frappe.get_doc(":Company", frm.doc.company).default_currency, null]]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return { filters: filters };
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
reverse_journal_entry: function() {
|
reverse_journal_entry: function() {
|
||||||
frappe.model.open_mapped_doc({
|
frappe.model.open_mapped_doc({
|
||||||
method: "erpnext.accounts.doctype.journal_entry.journal_entry.make_reverse_journal_entry",
|
method: "erpnext.accounts.doctype.journal_entry.journal_entry.make_reverse_journal_entry",
|
||||||
|
|||||||
@@ -1657,3 +1657,10 @@ def make_reverse_journal_entry(source_name, target_doc=None):
|
|||||||
)
|
)
|
||||||
|
|
||||||
return doclist
|
return doclist
|
||||||
|
|
||||||
|
|
||||||
|
@frappe.whitelist()
|
||||||
|
def get_against_type(doctype, txt, searchfield, start, page_len, filters):
|
||||||
|
against_types = frappe.db.get_list("Party Type", pluck="name") + ["Account"]
|
||||||
|
doctype = frappe.qb.DocType("DocType")
|
||||||
|
return frappe.qb.from_(doctype).select(doctype.name).where(doctype.name.isin(against_types)).run()
|
||||||
|
|||||||
Reference in New Issue
Block a user