fix(Purchase Receipt): copy project from first row when adding items

Adds `items_add` method to copy expense_account, cost_center and project from first row to newly added items, matching Purchase Invoice behavior.

(cherry picked from commit 21423676c9)
This commit is contained in:
Marc Ramser
2026-02-19 09:25:38 +01:00
committed by Mergify
parent 636414c0e4
commit 77da3306b5

View File

@@ -365,6 +365,15 @@ erpnext.stock.PurchaseReceiptController = class PurchaseReceiptController extend
apply_putaway_rule() {
if (this.frm.doc.apply_putaway_rule) erpnext.apply_putaway_rule(this.frm);
}
items_add(doc, cdt, cdn) {
const row = frappe.get_doc(cdt, cdn);
this.frm.script_manager.copy_from_first_row("items", row, [
"expense_account",
"cost_center",
"project",
]);
}
};
// for backward compatibility: combine new and previous states