-
-
Notifications
You must be signed in to change notification settings - Fork 63
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] coupon_criteria_multi_product: Migration to version 16.0 #160
[16.0][MIG] coupon_criteria_multi_product: Migration to version 16.0 #160
Conversation
9bd8382
to
6645cee
Compare
@chienandalu @pilarvargas-tecnativa please review |
In v16 the condition of having X products in the order lines to apply the promotion is incorporated. You can require X quantity of a specific product or X quantity in total of several products. What is not contemplated in v16 is that if we add several rules, for example:
@chienandalu what do you think? |
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.
@chienandalu what do you think?
Yes, we discussed that internally. And if you take a look in the migration commit that's where we're heading to.
- We'll need to make a migration script to turn the old criteria lines in the multiple rules needed.
- In the PR for sale_loyalty_criteria_multi_product include this one in a temporary commit so we can test the whole thing already
So that is what the "validate_all_rules" option is intended to do. Thanks for the clarification |
Checking another migration from @pilarvargas-tecnativa I devised that for the It won't be easy though as the rule check is quite encapsulated inside that method... |
e9c7748
to
c9fe76b
Compare
db340be
to
e927c27
Compare
@pilarvargas-tecnativa @chienandalu please review |
When the "Repeat" box is checked to apply the promotion to the sales order there must be the minimum quantity of any product specified in the rule, but that is the current behaviour of odoo. I think what should be checked is that if the box is not checked, the promotion is only applied if all the products specified in the rule are in the order lines and meeting the quantity. |
Ummm I hadn't thought about this, it's fine to me, what do you think of @chienandalu? |
As we decided in our meet last week we were going back to the original architecture as we couldn't hook into Odoo's methods to use the multi-rules in our favor so that's the way to go |
But you can check rule by rule if it's true, right now the behaviour of odoo is that if the promotion is applicable by buying 3 units of products a, b or c, the moment you add 3 units of any of them the promotion is applied. By checking the "Repeat" option we get the same behaviour, so we are not contemplating the functionality that those 3 products have to be present at the same time in the order lines. All this talking about a single rule, that when there are several if one passes, the promotion is applied. |
From outside of the method that checks the validity of the promos you only can tell if at least one rule passed the checks but you can't tell if one of them is invalid. Here's the relevant part of the code: https://github.com/odoo/odoo/blob/16.0/addons/sale_loyalty/models/sale_order.py#L844-L845 You can see that there are some flags that need to be activated in order to let the promo go, and if they don't the promo fails. But at soon as one is valid, the promo passes. You can't hook inside that logic to check them all (or others that might come on top). We would need a hook method at that level to do so |
fa941d5
to
51e636b
Compare
51e636b
to
4e7c39c
Compare
@Tecnativa TT44317