Skip to content

Commit

Permalink
fix: Amount for debit and credit notes with 0 qty line items (backport
Browse files Browse the repository at this point in the history
…#33902) (#34123)

fix: Amount for debit and credit notes with 0 qty line items (#33902)

(cherry picked from commit 47c9132)

Co-authored-by: Deepesh Garg <deepeshgarg6@gmail.com>
  • Loading branch information
mergify[bot] and deepeshgarg007 authored Feb 19, 2023
1 parent 58a006f commit 2408966
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion erpnext/public/js/controllers/taxes_and_totals.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,16 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
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);

Expand Down

0 comments on commit 2408966

Please sign in to comment.