-
Notifications
You must be signed in to change notification settings - Fork 7.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[v13 & v14]: Pricing Rule is not getting applied properly for Item Groups and Item Codes in Combination #33210
Comments
In Scenario 2 for the Pricing Rule 2 to be applied in case the Pricing Rule 3's min qty condition is not met then we have to make both the Pricing rules 2 and 3 have apply multiple = 1 and for pricing rule 1 generic for Item Group we have to uncheck the apply multiple Basically the priority of the rule has gone for a toss in version-13 We should redefine the below function
The scenario should be as below:
In this we should not use apply multiple in the below lines: erpnext/erpnext/accounts/doctype/pricing_rule/utils.py Lines 35 to 36 in 66dbf94
Basically the above line is only allowing the Item Code based Rules to go forward on if they are allowing multiple pricing rules to be applied. So in this kind of scenario if we have qty based discount on item_code then if apply_multiple is checked then it would apply discount to the Item Price as well which is not what a person would be wanting the person would be wanting to apply this Item Code rate if above minimum qty and if not then apply generic discount as per the customer's discount policy. I think this line was not there in version-12 and hence was working fine. We never checked on apply_multiple_pricing_rules for item_code related pricing rules which were qty based. In the function |
Solution: Change line: erpnext/erpnext/accounts/doctype/pricing_rule/utils.py Lines 71 to 72 in 66dbf94
to Also Change the lines: erpnext/erpnext/accounts/doctype/pricing_rule/utils.py Lines 33 to 36 in 66dbf94
|
Information about bug
We have customer specific pricing rule for Item Groups and their Child we also use a generic pricing rule for an Item Group so that the customers where there is no pricing rule the users cannot add discounts.
Use Case and Bug Scenario 1
Generic Pricing Rule:
Create 2nd Pricing Rules:
Now in the above case the person is expecting the Priority 2 pricing rule to be applied but in reality pricing rule with Priority 1 is applied and not with priority 2
Here the apply multiple is taking precedence over priority which seems to be incorrect. To avoid this we need to remove the apply multiple on the 1st Rule but then this rule is not applied at all. I guess apply multiple should be checked in same priority.
Use Case and Bug Scenario 2
Generic Pricing Rule:
Create 2nd Pricing Rules:
Create 3rd Pricing Rules:
Now if you make a Sales Order with Customer name in 2nd Rule and Item Code in Rule 3 with say qty = 501 then 3rd rule is applied as expected since its on item code and priority is 20 as well but if we have qty = 10 below the min qty then no rule gets applied since we have apply multiple unchecked for Item Code.
This is a problem since we are giving precedence to Apply Multiple whereas we should give precedence to priority this ways we can easily apply rules from Item Code, Item Groups, Brands etc
The above scenarios are working in version-12 but not in version-13 and version-14 since there is change in logic for Pricing Rule which has created a bug in such scenarios.
Module
accounts
Version
ERPNext: v13.42.1 (version-13)
Frappe Framework: v13.45.0 (version-13)
Installation method
None
Relevant log output / Stack trace / Full Error Message.
No response
The text was updated successfully, but these errors were encountered: