mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-14 12:25:09 +00:00
fix: make asset quantity and amount editable (#47226)
(cherry picked from commit 0d53e6ed7c)
Co-authored-by: Khushi Rawat <142375893+khushi8112@users.noreply.github.com>
This commit is contained in:
@@ -658,10 +658,6 @@ frappe.ui.form.on("Asset", {
|
|||||||
} else {
|
} else {
|
||||||
frm.set_value("purchase_invoice_item", data.purchase_invoice_item);
|
frm.set_value("purchase_invoice_item", data.purchase_invoice_item);
|
||||||
}
|
}
|
||||||
|
|
||||||
let is_editable = !data.is_multiple_items; // if multiple items, then fields should be read-only
|
|
||||||
frm.set_df_property("gross_purchase_amount", "read_only", is_editable);
|
|
||||||
frm.set_df_property("asset_quantity", "read_only", is_editable);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1169,7 +1169,6 @@ def get_values_from_purchase_doc(purchase_doc_name, item_code, doctype):
|
|||||||
frappe.throw(_(f"Selected {doctype} does not contain the Item Code {item_code}"))
|
frappe.throw(_(f"Selected {doctype} does not contain the Item Code {item_code}"))
|
||||||
|
|
||||||
first_item = matching_items[0]
|
first_item = matching_items[0]
|
||||||
is_multiple_items = len(matching_items) > 1
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"company": purchase_doc.company,
|
"company": purchase_doc.company,
|
||||||
@@ -1178,7 +1177,6 @@ def get_values_from_purchase_doc(purchase_doc_name, item_code, doctype):
|
|||||||
"asset_quantity": first_item.qty,
|
"asset_quantity": first_item.qty,
|
||||||
"cost_center": first_item.cost_center or purchase_doc.get("cost_center"),
|
"cost_center": first_item.cost_center or purchase_doc.get("cost_center"),
|
||||||
"asset_location": first_item.get("asset_location"),
|
"asset_location": first_item.get("asset_location"),
|
||||||
"is_multiple_items": is_multiple_items,
|
|
||||||
"purchase_receipt_item": first_item.name if doctype == "Purchase Receipt" else None,
|
"purchase_receipt_item": first_item.name if doctype == "Purchase Receipt" else None,
|
||||||
"purchase_invoice_item": first_item.name if doctype == "Purchase Invoice" else None,
|
"purchase_invoice_item": first_item.name if doctype == "Purchase Invoice" else None,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user