I’m trying to create Buy 1 Get 1 Promo in promotional Scheme and it works well in Point of Sales.
But, how to make my scheme to be multiple effect?
Meaning to say:
- buy 1 chicken get 1 chicken
- buy 2 chicken get 2 chicken
- buy 3 chicken get 3 chicken
- …
Right now, my scheme stuck in 1 chicken:
- buy 1 = free 1 chicken
- buy 2 = free 1 chicken (should be 2 chicken)
- buy 3 = free 1 chicken (should be 3 chicken)
- …
I found my solution now.
I can use “is Recursive” for this
But the thing is when I add a new promotional scheme, there is no further configuration when i tick “is Recursive” option to define my recursive range. I need to change it manually from “Price Rule” document.
This is how my Promotional Scheme document looks like:
And this is how the price rule looks like once it is created:
The other issue is if I want to make Buy 2 get 1 free promo and “round free”, this “recursive Every” field is rounded up so the behaviour is wrong.
Here how it behave:
Promo:
Buy 2 Get 1 Free
Transaction:
2 Coffee = Free 1 Tea → ( 2 /2 = 1)
3 Coffee = Free 2 Tea → (3 /2 = 1.5 → round free = 2)
4 Coffee = Free 2 Tea → (4 /2 = 2)
5 Coffee = Free 3 Tea → (5 /2 = 2.5 → round free = 3)
6 Coffee = Free 3 Tea → (6 /2 = 3)
…
SO… I make some modification on my /erpnext/accounts/doctype/pricing_rule/utils.py line 652
from:
qty = round(qty)
to:
qty = math.trunc(qty)
and don’t forget to:
import math