From 4ef9d289e89387fdee660cb7b43161c64730c215 Mon Sep 17 00:00:00 2001 From: Saqib Ansari Date: Wed, 22 Dec 2021 13:23:42 +0530 Subject: [PATCH] fix(sales-invoice): cannot create debit note with zero qty (cherry picked from commit 04ea42ce5267c7ae9d5d286631d938c106116ede) --- erpnext/controllers/taxes_and_totals.py | 2 ++ erpnext/public/js/controllers/taxes_and_totals.js | 2 ++ 2 files changed, 4 insertions(+) diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py index b9c95508152..f0983103cd4 100644 --- a/erpnext/controllers/taxes_and_totals.py +++ b/erpnext/controllers/taxes_and_totals.py @@ -139,6 +139,8 @@ class calculate_taxes_and_totals(object): if not item.qty and self.doc.get("is_return"): item.amount = flt(-1 * item.rate, item.precision("amount")) + elif not item.qty and self.doc.get("is_debit_note"): + item.amount = flt(item.rate, item.precision("amount")) else: item.amount = flt(item.rate * item.qty, item.precision("amount")) diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js index 864c0957d1e..07e251efa22 100644 --- a/erpnext/public/js/controllers/taxes_and_totals.js +++ b/erpnext/public/js/controllers/taxes_and_totals.js @@ -114,6 +114,8 @@ erpnext.taxes_and_totals = erpnext.payments.extend({ if ((!item.qty) && me.frm.doc.is_return) { item.amount = flt(item.rate * -1, precision("amount", item)); + } else if ((!item.qty) && me.frm.doc.is_debit_note) { + item.amount = flt(item.rate, precision("amount", item)); } else { item.amount = flt(item.rate * item.qty, precision("amount", item)); }