-
-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] sale_coupon_incompatibility: Migration to 16.0 and rename to sa…
…le_loyalty_incompatibility
- Loading branch information
1 parent
b612805
commit dc2d711
Showing
10 changed files
with
70 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
# Copyright 2021 Tecnativa - David Vidal | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
{ | ||
"name": "Coupon incompatibilities", | ||
"name": "Loyalty incompatibilities", | ||
"summary": "Allows to set incompatibility rules between promotions", | ||
"version": "15.0.1.0.0", | ||
"version": "16.0.1.0.0", | ||
"development_status": "Production/Stable", | ||
"category": "Sale", | ||
"website": "https://github.com/OCA/sale-promotion", | ||
"author": "Tecnativa, Odoo Community Association (OCA)", | ||
"maintainers": ["chienandalu"], | ||
"license": "AGPL-3", | ||
"depends": ["sale_coupon", "coupon_incompatibility"], | ||
"depends": ["loyalty_incompatibility"], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
from . import coupon_program | ||
from . import sale_coupon | ||
from . import sale_order |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Copyright 2021 Tecnativa - David Vidal | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
from odoo import _, models | ||
|
||
|
||
class SaleOrder(models.Model): | ||
_inherit = "sale.order" | ||
|
||
def _program_check_compute_points(self, programs): | ||
"""Coupon incompatibility rules. Check the error strings for a detailed case | ||
detail.""" | ||
self.ensure_one() | ||
result = super()._program_check_compute_points(programs) | ||
order_programs = self.order_line.reward_id.program_id | ||
for program in programs: | ||
if any( | ||
{x in order_programs for x in program.incompatible_promotion_ids} | ||
): | ||
result[program] = { | ||
"error": _( | ||
"This promotion is incompatible with other set already in the " | ||
"order so it can't be applied." | ||
) | ||
} | ||
return result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
Once you've configured your incompatibilities, go to a quotations that fulfills your | ||
incompatible promotions and try to set them altogether. | ||
|
||
- A coupon program with no code, won't be applied. | ||
- A coupon or program code, will raise an error. | ||
- A loyalty program with no code, won't be applied. | ||
- A loyalty or program code, will raise an error. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters