mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 10:49:09 +00:00
Merge pull request #29194 from frappe/mergify/bp/version-13-hotfix/pr-28994
fix: cannot create debit note with zero qty (backport #28994)
This commit is contained in:
@@ -114,7 +114,7 @@ class AccountsController(TransactionBase):
|
|||||||
_('{0} is blocked so this transaction cannot proceed').format(supplier_name), raise_exception=1)
|
_('{0} is blocked so this transaction cannot proceed').format(supplier_name), raise_exception=1)
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
if not self.get('is_return'):
|
if not self.get('is_return') and not self.get('is_debit_note'):
|
||||||
self.validate_qty_is_not_zero()
|
self.validate_qty_is_not_zero()
|
||||||
|
|
||||||
if self.get("_action") and self._action != "update_after_submit":
|
if self.get("_action") and self._action != "update_after_submit":
|
||||||
|
|||||||
@@ -139,6 +139,8 @@ class calculate_taxes_and_totals(object):
|
|||||||
|
|
||||||
if not item.qty and self.doc.get("is_return"):
|
if not item.qty and self.doc.get("is_return"):
|
||||||
item.amount = flt(-1 * item.rate, item.precision("amount"))
|
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:
|
else:
|
||||||
item.amount = flt(item.rate * item.qty, item.precision("amount"))
|
item.amount = flt(item.rate * item.qty, item.precision("amount"))
|
||||||
|
|
||||||
|
|||||||
@@ -114,6 +114,8 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
|
|||||||
|
|
||||||
if ((!item.qty) && me.frm.doc.is_return) {
|
if ((!item.qty) && me.frm.doc.is_return) {
|
||||||
item.amount = flt(item.rate * -1, precision("amount", item));
|
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 {
|
} else {
|
||||||
item.amount = flt(item.rate * item.qty, precision("amount", item));
|
item.amount = flt(item.rate * item.qty, precision("amount", item));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user