From 2caac240716e502f9e2dad961ec40ce825572b71 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Thu, 21 May 2020 10:09:42 +0530 Subject: [PATCH] fix: item tax template not applied if valid from is blank --- erpnext/accounts/page/pos/pos.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js index 06575ac3a69..28c9149c561 100755 --- a/erpnext/accounts/page/pos/pos.js +++ b/erpnext/accounts/page/pos/pos.js @@ -1459,7 +1459,11 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ this.child.serial_no = (this.item_serial_no[this.child.item_code] ? this.item_serial_no[this.child.item_code][0] : ''); - const tax_template_is_valid = frappe.datetime.get_diff(frappe.datetime.now_date(), this.items[0].valid_from) > 0; + const tax_template_is_valid = true; + if (this.items && this.items[0].valid_from) { + tax_template_is_valid = frappe.datetime.get_diff(frappe.datetime.now_date(), + this.items[0].valid_from) > 0; + } this.child.item_tax_template = tax_template_is_valid ? this.items[0].item_tax_template : ''; this.child.item_tax_rate = JSON.stringify(this.tax_data[this.child.item_tax_template]);