Skip to content

Commit

Permalink
fix: incorrect discount on other item
Browse files Browse the repository at this point in the history
When discount is applied on other item, don't update `discount_amount`
as the amount is calculated for current item

(cherry picked from commit 654764e)
  • Loading branch information
ruthra-kumar authored and mergify[bot] committed Jun 21, 2024
1 parent 7b322e7 commit 77f4199
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions erpnext/public/js/controllers/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -1733,6 +1733,10 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
me.frm.doc.items.forEach(d => {
if (in_list(JSON.parse(data.apply_rule_on_other_items), d[data.apply_rule_on])) {
for(var k in data) {
if (data.pricing_rule_for == "Discount Percentage" && data.apply_rule_on_other_items && k == "discount_amount") {
continue;
}

if (in_list(fields, k) && data[k] && (data.price_or_product_discount === 'Price' || k === 'pricing_rules')) {
frappe.model.set_value(d.doctype, d.name, k, data[k]);
}
Expand Down

0 comments on commit 77f4199

Please sign in to comment.