fix: auto complete sales order rows in production plan (#27352)

* fix: auto complete sales order rows in production plan

* fix: sider
This commit is contained in:
Alan 2021-09-08 16:48:42 +05:30 committed by GitHub
parent 9c27f9be1e
commit 81d3524d27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 0 deletions

View File

@ -434,6 +434,25 @@ frappe.ui.form.on("Material Request Plan Item", {
}
});
frappe.ui.form.on("Production Plan Sales Order", {
sales_order(frm, cdt, cdn) {
const { sales_order } = locals[cdt][cdn];
if (!sales_order) {
return;
}
frappe.call({
method: "erpnext.manufacturing.doctype.production_plan.production_plan.get_so_details",
args: { sales_order },
callback(r) {
const {transaction_date, customer, grand_total} = r.message;
frappe.model.set_value(cdt, cdn, 'sales_order_date', transaction_date);
frappe.model.set_value(cdt, cdn, 'customer', customer);
frappe.model.set_value(cdt, cdn, 'grand_total', grand_total);
}
});
}
});
cur_frm.fields_dict['sales_orders'].grid.get_field("sales_order").get_query = function() {
return{
filters: [

View File

@ -800,6 +800,12 @@ def get_bin_details(row, company, for_warehouse=None, all_warehouse=False):
group by item_code, warehouse
""".format(conditions=conditions), { "item_code": row['item_code'] }, as_dict=1)
@frappe.whitelist()
def get_so_details(sales_order):
return frappe.db.get_value("Sales Order", sales_order,
['transaction_date', 'customer', 'grand_total'], as_dict=1
)
def get_warehouse_list(warehouses):
warehouse_list = []