mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-18 19:07:55 +00:00
fix: guard scio row lookup in stock entry items_add
check the result of find() before reading t_warehouse off it. on a 'receive from customer' entry with no row carrying scio_detail, find() returns undefined and items_add throws a typeerror. the throw rejects the serially-run handler chain, so the stock entry controller's own items_add never runs and the new row silently loses its target warehouse, expense account, cost center and serial/batch field defaults. leave t_warehouse unset when no reference row exists, so the rest of the chain still runs.
This commit is contained in:
@@ -997,7 +997,10 @@ frappe.ui.form.on("Stock Entry Detail", {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (frm.doc.purpose === "Receive from Customer") {
|
if (frm.doc.purpose === "Receive from Customer") {
|
||||||
item.t_warehouse = frm.doc.items.find((item) => item.scio_detail).t_warehouse;
|
const scio_row = frm.doc.items.find((row) => row.scio_detail);
|
||||||
|
if (scio_row) {
|
||||||
|
item.t_warehouse = scio_row.t_warehouse;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
set_basic_rate_manually(frm, cdt, cdn) {
|
set_basic_rate_manually(frm, cdt, cdn) {
|
||||||
|
|||||||
Reference in New Issue
Block a user