fix: for asset's purchase_date, if bill_date is set, use that instead of posting_date

(cherry picked from commit f322c608cf)
This commit is contained in:
anandbaburajan
2022-10-31 12:41:37 +05:30
committed by Mergify
parent 5a211813d3
commit 1d23c9a9fd

View File

@@ -384,7 +384,11 @@ frappe.ui.form.on('Asset', {
set_values_from_purchase_doc: function(frm, doctype, purchase_doc) {
frm.set_value('company', purchase_doc.company);
frm.set_value('purchase_date', purchase_doc.posting_date);
if (purchase_doc.bill_date) {
frm.set_value('purchase_date', purchase_doc.bill_date);
} else {
frm.set_value('purchase_date', purchase_doc.posting_date);
}
const item = purchase_doc.items.find(item => item.item_code === frm.doc.item_code);
if (!item) {
doctype_field = frappe.scrub(doctype)