fix: Amount for debit and credit notes with 0 qty line items (#33902)
diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js
index 2ce0c7e..a87c3ec 100644
--- a/erpnext/public/js/controllers/taxes_and_totals.js
+++ b/erpnext/public/js/controllers/taxes_and_totals.js
@@ -126,7 +126,16 @@
frappe.model.round_floats_in(item);
item.net_rate = item.rate;
item.qty = item.qty === undefined ? (me.frm.doc.is_return ? -1 : 1) : item.qty;
- item.net_amount = item.amount = flt(item.rate * item.qty, precision("amount", item));
+
+ if (!(me.frm.doc.is_return || me.frm.doc.is_debit_note)) {
+ item.net_amount = item.amount = flt(item.rate * item.qty, precision("amount", item));
+ }
+ else {
+ let qty = item.qty || 1;
+ qty = me.frm.doc.is_return ? -1 * qty : qty;
+ item.net_amount = item.amount = flt(item.rate * qty, precision("amount", item));
+ }
+
item.item_tax_amount = 0.0;
item.total_weight = flt(item.weight_per_unit * item.stock_qty);