Skip to content

Commit

Permalink
fix: update discounting on mixed conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
DHINESH00 committed Dec 19, 2024
1 parent 7fed467 commit d541259
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions erpnext/public/js/controllers/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -1856,18 +1856,16 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe

apply_rule_on_other_items(args) {
const me = this;
const fields = ["discount_percentage", "pricing_rules", "discount_amount", "rate"];
const fields = ["pricing_rules"];

for(var k in args) {
let data = args[k];

if (data && data.apply_rule_on_other_items && JSON.parse(data.apply_rule_on_other_items)) {
fields.push(frappe.scrub(data.pricing_rule_for))
me.frm.doc.items.forEach(d => {
if (in_list(JSON.parse(data.apply_rule_on_other_items), d[data.apply_rule_on]) && d.item_code === data.item_code) {
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 d541259

Please sign in to comment.