fix: Blanket Order in SO/PO child tables (#21442)
This commit is contained in:
parent
daf37e7570
commit
299e217668
@ -27,15 +27,6 @@ frappe.ui.form.on("Purchase Order", {
|
||||
frm.set_indicator_formatter('item_code',
|
||||
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() {
|
||||
return {
|
||||
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"],
|
||||
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()
|
||||
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() {
|
||||
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);
|
||||
},
|
||||
|
||||
@ -148,7 +139,7 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
|
||||
}
|
||||
|
||||
this.frm.add_custom_button(__('Pick List'), () => this.create_pick_list(), __('Create'));
|
||||
|
||||
|
||||
const order_is_a_sale = ["Sales", "Shopping Cart"].indexOf(doc.order_type) !== -1;
|
||||
const order_is_maintenance = ["Maintenance"].indexOf(doc.order_type) !== -1;
|
||||
// order type has been customised then show all the action buttons
|
||||
|
Loading…
x
Reference in New Issue
Block a user