mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-14 07:01:56 +00:00
fix(stock): show qty (company) and qty (warehouse) in sales transactions
company was passed to get_bin_details only for purchase order, so company_total_stock was never returned for sales order, quotation, sales invoice and delivery note and the qty (company) column always read zero. pass ctx.company for every doctype, which also drops the dependency on doc being supplied. on the client, set_actual_qty copied only actual_qty out of the response, so qty (company) never refreshed on a warehouse change. use frm.call with child so every bin field is applied, pass include_child_warehouses to match the server, and include quotation.
This commit is contained in:
committed by
Sudharsanan Ashok
parent
33abc53d7a
commit
ab30bab6cb
@@ -284,19 +284,17 @@ erpnext.sales_common = {
|
||||
|
||||
set_actual_qty(doc, cdt, cdn) {
|
||||
let row = locals[cdt][cdn];
|
||||
let sales_doctypes = ["Sales Invoice", "Delivery Note", "Sales Order"];
|
||||
let sales_doctypes = ["Sales Invoice", "Delivery Note", "Sales Order", "Quotation"];
|
||||
|
||||
if (row.item_code && row.warehouse && sales_doctypes.includes(doc.doctype)) {
|
||||
frappe.call({
|
||||
return this.frm.call({
|
||||
method: "erpnext.stock.get_item_details.get_bin_details",
|
||||
child: row,
|
||||
args: {
|
||||
item_code: row.item_code,
|
||||
warehouse: row.warehouse,
|
||||
},
|
||||
callback(r) {
|
||||
if (r.message) {
|
||||
frappe.model.set_value(cdt, cdn, "actual_qty", r.message.actual_qty);
|
||||
}
|
||||
company: doc.company,
|
||||
include_child_warehouses: true,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -323,10 +323,9 @@ def update_bin_details(ctx: frappe._dict, out: frappe._dict, doc):
|
||||
out.update(get_bin_details(ctx.item_code, ctx.from_warehouse))
|
||||
|
||||
elif out.get("warehouse"):
|
||||
company = ctx.company if (doc and doc.get("doctype") == "Purchase Order") else None
|
||||
|
||||
# calculate company_total_stock only for po
|
||||
bin_details = get_bin_details(ctx.item_code, out.warehouse, company, include_child_warehouses=True)
|
||||
bin_details = get_bin_details(
|
||||
ctx.item_code, out.warehouse, ctx.company, include_child_warehouses=True
|
||||
)
|
||||
|
||||
out.update(bin_details)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user