ERPNext.com Frappe Cloud Support Partners Foundation Frappe School

Trying to understand pricing rule priority

I’m trying to setup pricing rules but I just can’t seem to get it the way I want it.

So, let me explain what I’m trying to accomplish here. It’s a pretty simple pricing rule schema, basically there are two pricing level priorities.

  1. Customer default discount percentage.
    This is very easy and I was able to accomplish using apply on: item group = all item groups
  2. Override default discount percentage if a brand rule exists.
    I thought this would be straight forward just using apply on: brand (It didn’t work)

It always just uses the first pricing rule.
Here is some additional information about the pricing rule setup.

  1. { "data": { "name": "PRLE-0001", "owner": "Administrator", "creation": "2021-11-16 19:40:16.816529", "modified": "2021-11-16 19:41:05.151555", "modified_by": "Administrator", "idx": 0, "docstatus": 0, "naming_series": "PRLE-.####", "title": "test-default discount", "disable": 0, "apply_on": "Item Group", "price_or_product_discount": "Price", "mixed_conditions": 0, "is_cumulative": 0, "coupon_code_based": 0, "apply_rule_on_other": "", "selling": 1, "buying": 0, "applicable_for": "Customer", "customer": "test", "min_qty": 0, "max_qty": 0, "min_amt": 0, "max_amt": 0, "same_item": 0, "free_qty": 0, "free_item_rate": 0, "is_recursive": 0, "valid_from": "2021-11-16", "company": "test", "currency": "CAD", "margin_type": "Percentage", "margin_rate_or_amount": 0, "rate_or_discount": "Discount Percentage", "apply_discount_on": "Grand Total", "rate": 0, "discount_amount": 0, "discount_percentage": 10, "threshold_percentage": 0, "priority": "1", "apply_multiple_pricing_rules": 0, "apply_discount_on_rate": 0, "validate_applied_rule": 0, "doctype": "Pricing Rule", "items": [], "item_groups": [ { "name": "2090d94929", "owner": "Administrator", "creation": "2021-11-16 19:40:16.816529", "modified": "2021-11-16 19:41:05.151555", "modified_by": "Administrator", "parent": "PRLE-0001", "parentfield": "item_groups", "parenttype": "Pricing Rule", "idx": 1, "docstatus": 0, "item_group": "All Item Groups", "doctype": "Pricing Rule Item Group" } ], "brands": [] } }

  2. { "data": { "name": "PRLE-0002", "owner": "Administrator", "creation": "2021-11-16 19:41:49.030174", "modified": "2021-11-16 19:41:49.030174", "modified_by": "Administrator", "idx": 0, "docstatus": 0, "naming_series": "PRLE-.####", "title": "test-brand a", "disable": 0, "apply_on": "Brand", "price_or_product_discount": "Price", "mixed_conditions": 0, "is_cumulative": 0, "coupon_code_based": 0, "apply_rule_on_other": "", "selling": 1, "buying": 0, "applicable_for": "Customer", "customer": "test", "min_qty": 0, "max_qty": 0, "min_amt": 0, "max_amt": 0, "same_item": 0, "free_qty": 0, "free_item_rate": 0, "is_recursive": 0, "valid_from": "2021-11-16", "company": "test", "currency": "CAD", "margin_type": "Percentage", "margin_rate_or_amount": 0, "rate_or_discount": "Discount Percentage", "apply_discount_on": "Grand Total", "rate": 0, "discount_amount": 0, "discount_percentage": 20, "threshold_percentage": 0, "priority": "2", "apply_multiple_pricing_rules": 0, "apply_discount_on_rate": 0, "validate_applied_rule": 0, "doctype": "Pricing Rule", "items": [], "item_groups": [], "brands": [ { "name": "3136cbe6a1", "owner": "Administrator", "creation": "2021-11-16 19:41:49.030174", "modified": "2021-11-16 19:41:49.030174", "modified_by": "Administrator", "parent": "PRLE-0002", "parentfield": "brands", "parenttype": "Pricing Rule", "idx": 1, "docstatus": 0, "brand": "Brand A", "doctype": "Pricing Rule Brand" } ] } }

The item: Test 1 has Brand A
The item Test 2 has Brand B
You can see only the first pricing rule is applied for both. From my understanding Test 1 should have pricing rule 2 applied and Test 2 should have pricing rule 1 applied.

Any Ideas where I went wrong with this?