fix: Blanket Order in SO/PO child tables (#21443)
This commit is contained in:
parent
85bbb04fa1
commit
ac98eb5448
@ -27,15 +27,6 @@ frappe.ui.form.on("Purchase Order", {
|
|||||||
frm.set_indicator_formatter('item_code',
|
frm.set_indicator_formatter('item_code',
|
||||||
function(doc) { return (doc.qty<=doc.received_qty) ? "green" : "orange" })
|
function(doc) { return (doc.qty<=doc.received_qty) ? "green" : "orange" })
|
||||||
|
|
||||||
frm.set_query("blanket_order", "items", function() {
|
|
||||||
return {
|
|
||||||
filters: {
|
|
||||||
"company": frm.doc.company,
|
|
||||||
"docstatus": 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
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",
|
||||||
|
@ -371,6 +371,19 @@ def get_account_list(doctype, txt, searchfield, start, page_len, filters):
|
|||||||
fields = ["name", "parent_account"],
|
fields = ["name", "parent_account"],
|
||||||
limit_start=start, limit_page_length=page_len, as_list=True)
|
limit_start=start, limit_page_length=page_len, as_list=True)
|
||||||
|
|
||||||
|
def get_blanket_orders(doctype, txt, searchfield, start, page_len, filters):
|
||||||
|
return frappe.db.sql("""select distinct bo.name, bo.blanket_order_type, bo.to_date
|
||||||
|
from `tabBlanket Order` bo, `tabBlanket Order Item` boi
|
||||||
|
where
|
||||||
|
boi.parent = bo.name
|
||||||
|
and boi.item_code = {item_code}
|
||||||
|
and bo.blanket_order_type = '{blanket_order_type}'
|
||||||
|
and bo.company = {company}
|
||||||
|
and bo.docstatus = 1"""
|
||||||
|
.format(item_code = frappe.db.escape(filters.get("item")),
|
||||||
|
blanket_order_type = filters.get("blanket_order_type"),
|
||||||
|
company = frappe.db.escape(filters.get("company"))
|
||||||
|
))
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_income_account(doctype, txt, searchfield, start, page_len, filters):
|
def get_income_account(doctype, txt, searchfield, start, page_len, filters):
|
||||||
|
@ -175,6 +175,20 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.frm.fields_dict["items"].grid.get_field('blanket_order')) {
|
||||||
|
this.frm.set_query("blanket_order", "items", function(doc, cdt, cdn) {
|
||||||
|
var item = locals[cdt][cdn];
|
||||||
|
return {
|
||||||
|
query: "erpnext.controllers.queries.get_blanket_orders",
|
||||||
|
filters: {
|
||||||
|
"company": doc.company,
|
||||||
|
"blanket_order_type": doc.doctype === "Sales Order" ? "Selling" : "Purchasing",
|
||||||
|
"item": item.item_code
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
onload: function() {
|
onload: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
|
@ -65,15 +65,6 @@ frappe.ui.form.on("Sales Order", {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
frm.set_query("blanket_order", "items", function() {
|
|
||||||
return {
|
|
||||||
filters: {
|
|
||||||
"company": frm.doc.company,
|
|
||||||
"docstatus": 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
erpnext.queries.setup_warehouse_query(frm);
|
erpnext.queries.setup_warehouse_query(frm);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user