fix(sales-invoice): cannot create debit note with zero qty

This commit is contained in:
Saqib Ansari 2021-12-22 13:23:42 +05:30
parent 6acdb2f00b
commit 04ea42ce52
2 changed files with 4 additions and 0 deletions

View File

@ -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"))

View File

@ -114,6 +114,8 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments {
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));
}