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

This commit is contained in:
anandbaburajan 2022-10-31 12:41:37 +05:30
parent 54c2ffc36b
commit f322c608cf

View File

@ -432,7 +432,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)