fix: Don't throw exception on invoice lines when there is no item_code (fixes #24640)

This commit is contained in:
casesolved-co-uk 2021-02-16 05:48:50 +00:00
parent c5b94adc87
commit a780306ec7

View File

@ -1885,7 +1885,6 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
frappe.throw(__("Please enter Item Code to get batch no"));
} else if (doc.doctype == "Purchase Receipt" ||
(doc.doctype == "Purchase Invoice" && doc.update_stock)) {
return {
filters: {'item': item.item_code}
}
@ -1911,9 +1910,8 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
set_query_for_item_tax_template: function(doc, cdt, cdn) {
var item = frappe.get_doc(cdt, cdn);
if(!item.item_code) {
frappe.throw(__("Please enter Item Code to get item taxes"));
return doc.company ? {filters: {company: doc.company}} : {};
} else {
let filters = {
'item_code': item.item_code,
'valid_from': ["<=", doc.transaction_date || doc.bill_date || doc.posting_date],
@ -2124,4 +2122,4 @@ erpnext.apply_putaway_rule = (frm, purpose=null) => {
}
}
});
};
};