Skip to content
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

[14.0][FIX] sale_promotion_discount_in_field #146

Conversation

Volodiay622
Copy link

when Promo code used, promotion was not added to Applied Promo Program of current order.

@Volodiay622 Volodiay622 force-pushed the 14.0-t2752-sale_promotion_discount_in_field-fix_discount_apply branch 2 times, most recently from 6694cf8 to fa9fb19 Compare August 21, 2023 06:47
Copy link

@geomer198 geomer198 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix comments.

program = self.env["coupon.program"].search(program_domain)
if (
program
and program.reward_type == "discount_line"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this conditions need add in search domain on the 15th code lines.
Then like this:

if program:
   ...
   return error_status
return super().apply_coupon(order, coupon_code)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved


def apply_coupon(self, order, coupon_code):
# OVERRIDE to apply the program to the order without reward lines
error_status = {}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this variable not need set because error_status use, if program is exists.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

2475.0,
"The order total with programs should be 2475.00",
)
self.assertEqual(result, {})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't have message for assertion.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

error_status = {}
program_domain = order._get_coupon_program_domain()
program_domain = expression.AND(
[program_domain, [("promo_code", "=", coupon_code)]]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change domain like this.

program_domain = expression.AND(
    [program_domain, [("promo_code", "=", coupon_code), ("reward_type", "=", "discount_line"), ("promo_applicability", "!=", "on_next_order")]]
)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

Copy link
Contributor

@francesco-ooops francesco-ooops left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functional OK!

Before this PR, "max customer applications" from sale_coupon_limit could be bypassed with reward type = discount in line

@chienandalu good for you?

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

when Promo code used, promotion was not added to Applied Promo Program
of current order.
@Volodiay622 Volodiay622 force-pushed the 14.0-t2752-sale_promotion_discount_in_field-fix_discount_apply branch from 17169c0 to 9cea208 Compare August 28, 2023 15:18
@francesco-ooops
Copy link
Contributor

@pedrobaeza merge please?

@pedrobaeza pedrobaeza added this to the 14.0 milestone Aug 31, 2023
Copy link
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/ocabot merge patch

@@ -0,0 +1 @@
"This module should be renamed sale_coupon_discount_in_field in future migrations for naming consistency."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or loyalty in 16+...

@OCA-git-bot
Copy link
Contributor

What a great day to merge this nice PR. Let's do it!
Prepared branch 14.0-ocabot-merge-pr-146-by-pedrobaeza-bump-patch, awaiting test results.

OCA-git-bot added a commit that referenced this pull request Aug 31, 2023
Signed-off-by pedrobaeza
@OCA-git-bot
Copy link
Contributor

On my way to merge this fine PR!
Prepared branch 14.0-ocabot-merge-pr-146-by-pedrobaeza-bump-patch, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit a0ea4d4 into OCA:14.0 Aug 31, 2023
6 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at d5df43a. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants