-
-
Notifications
You must be signed in to change notification settings - Fork 64
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
[16.0][MIG] sale_coupon_limit > sale_loyalty_limit: Migration to version 16.0 #156
Conversation
eacc42e
to
3082f88
Compare
fb0a886
to
4871fb4
Compare
96cd8c4
to
d2b811e
Compare
d2b811e
to
cff2bf2
Compare
@chienandalu I have gone round the whole code reducing what was not necessary:
Keeping in mind that "if one rule passes, they all pass":
I hope everything is well explained and understood :) |
What I am left wondering is that I cannot use the computed field to get the number of times a promotion has been used due to the execution of the _update_programs_and_rewards method when confirming a sales order because it does not exclude the current order. |
Why would you exclude the current order? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When calculating how many times it has been used it is not necessary to take into account the coupons, you simply have to take into account the order lines where the program that complies with the rules has been applied.
What about generated coupons?
Keeping in mind that "if one rule passes, they all pass"...
I'm wondering if it makes much sense to have the limits at that level and not at loyalty.program globaly
Because when confirming the sale order (action_confirm) it calls again _update_programs_and_rewards. If we set the limit to 1 use, when the promotion is applied it calls _update_programs_and_rewards and if it has not been used it will calculate 0 uses, when confirming the sales order it calls _update_programs_and_rewards again, it recalculates the uses and will take into account the use in the current sales order and eliminates the reward line, so if the limit is set to 1 it will never be applied after confirming the order. You would have to set the limit to 2 in order for it to be applied 1 time. |
It doesn't have to, the logical thing to do is to configure all the application parameters of a promotion in the same rule, as it was done in v15, although the logic adapts to what odoo proposes. |
But I can't figure out a case where you could take advantage of multiple rules with different limits. What the purpose would be? It could fit in a multiple rewards design, as you could stablish different limits to different rewards. But in any case I wouldn't complicate this more than necessary and simply put the limits at program level where they were |
d2164e6
to
b79a932
Compare
8e347f1
to
7125bd8
Compare
We add some compute fields to check the current promotion usage by the limited users. That allows us to refactor the check method a little bit as well unifying the logic. TT30847
Coupons are reset when a sale order is cancelled, but applied programs remain linked to the cancelled order. As they're cancelled, we should not count them in the limits. TT34264
Sometimes Odoo doesn't remove the rules properly until the promotions are refreshed. This could lead to count mismatches. We wan't to ensure the count looking at the lines instead. TT34266
For complying with rules.
Simplify rule and ensure compatibility with sale_coupon_multiple_code_program wich allows to use multiple code programs putting them in the no code promotions many2many field.
Allow coupon_limit settings to be used by other loyalty modules
Currently translated at 100.0% (9 of 9 strings) Translation: sale-promotion-15.0/sale-promotion-15.0-sale_coupon_limit Translate-URL: https://translation.odoo-community.org/projects/sale-promotion-15-0/sale-promotion-15-0-sale_coupon_limit/it/
7125bd8
to
480025d
Compare
480025d
to
2f1901d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks :)
@CarlosRoca13 take a look please :) |
/ocabot merge nobump |
This PR looks fantastic, let's merge it! |
Congratulations, your PR was merged at e2e702a. Thanks a lot for contributing to OCA. ❤️ |
Renamed to sale_loyalty_limit
Pending from:
cc @Tecnativa TT44347
@chienandalu @ernesto-garcia-tecnativa please review