Skip to content

Commit

Permalink
[MIG] sale_coupon_incompatibility: Migration to 16.0 and rename to sa…
Browse files Browse the repository at this point in the history
…le_loyalty_incompatibility
  • Loading branch information
ernesto-garcia-tecnativa committed Oct 16, 2023
1 parent b612805 commit dc2d711
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 76 deletions.
22 changes: 11 additions & 11 deletions sale_loyalty_incompatibility/README.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
========================
Coupon incompatibilities
========================
=========================
Loyalty incompatibilities
=========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:5f10374003403bbcd364cf5e67d597e54a8528030be49132d4fda54d30f4df16
!! source digest: sha256:0a08b29a4c259fa45c1a162e2539bc400e9ecfa97b60f4fc878faca7dd3fb701
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
Expand All @@ -17,13 +17,13 @@ Coupon incompatibilities
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsale--promotion-lightgray.png?logo=github
:target: https://github.com/OCA/sale-promotion/tree/15.0/sale_coupon_incompatibility
:target: https://github.com/OCA/sale-promotion/tree/16.0-mig-sale_coupon_incompatibility/sale_loyalty_incompatibility
:alt: OCA/sale-promotion
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/sale-promotion-15-0/sale-promotion-15-0-sale_coupon_incompatibility
:target: https://translation.odoo-community.org/projects/sale-promotion-16-0-mig-sale_coupon_incompatibility/sale-promotion-16-0-mig-sale_coupon_incompatibility-sale_loyalty_incompatibility
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/sale-promotion&target_branch=15.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/sale-promotion&target_branch=16.0-mig-sale_coupon_incompatibility
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand All @@ -42,16 +42,16 @@ Usage
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.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-promotion/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/sale-promotion/issues/new?body=module:%20sale_coupon_incompatibility%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/sale-promotion/issues/new?body=module:%20sale_loyalty_incompatibility%0Aversion:%2016.0-mig-sale_coupon_incompatibility%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Expand Down Expand Up @@ -93,6 +93,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-chienandalu|

This module is part of the `OCA/sale-promotion <https://github.com/OCA/sale-promotion/tree/15.0/sale_coupon_incompatibility>`_ project on GitHub.
This module is part of the `OCA/sale-promotion <https://github.com/OCA/sale-promotion/tree/16.0-mig-sale_coupon_incompatibility/sale_loyalty_incompatibility>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
6 changes: 3 additions & 3 deletions sale_loyalty_incompatibility/__manifest__.py
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"],
}
16 changes: 8 additions & 8 deletions sale_loyalty_incompatibility/i18n/es.po
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_coupon_incompatibility
# * sale_loyalty_incompatibility
#
msgid ""
msgstr ""
Expand All @@ -17,19 +17,19 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 3.2.2\n"

#. module: sale_coupon_incompatibility
#: model:ir.model,name:sale_coupon_incompatibility.model_coupon_coupon
#. module: sale_loyalty_incompatibility
#: model:ir.model,name:sale_loyalty_incompatibility.model_coupon_coupon
msgid "Coupon"
msgstr "Cupón"

#. module: sale_coupon_incompatibility
#: model:ir.model,name:sale_coupon_incompatibility.model_coupon_program
#. module: sale_loyalty_incompatibility
#: model:ir.model,name:sale_loyalty_incompatibility.model_coupon_program
msgid "Coupon display on a website"
msgstr ""

#. module: sale_coupon_incompatibility
#: code:addons/sale_coupon_incompatibility/models/coupon_program.py:0
#: code:addons/sale_coupon_incompatibility/models/sale_coupon.py:0
#. module: sale_loyalty_incompatibility
#: code:addons/sale_loyalty_incompatibility/models/coupon_program.py:0
#: code:addons/sale_loyalty_incompatibility/models/sale_coupon.py:0
#, python-format
msgid ""
"This promotion is incompatible with other set already in the order so it "
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_coupon_incompatibility
# * sale_loyalty_incompatibility
#
msgid ""
msgstr ""
Expand All @@ -13,19 +13,19 @@ msgstr ""
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: sale_coupon_incompatibility
#: model:ir.model,name:sale_coupon_incompatibility.model_coupon_coupon
#. module: sale_loyalty_incompatibility
#: model:ir.model,name:sale_loyalty_incompatibility.model_coupon_coupon
msgid "Coupon"
msgstr ""

#. module: sale_coupon_incompatibility
#: model:ir.model,name:sale_coupon_incompatibility.model_coupon_program
#. module: sale_loyalty_incompatibility
#: model:ir.model,name:sale_loyalty_incompatibility.model_coupon_program
msgid "Coupon display on a website"
msgstr ""

#. module: sale_coupon_incompatibility
#: code:addons/sale_coupon_incompatibility/models/coupon_program.py:0
#: code:addons/sale_coupon_incompatibility/models/sale_coupon.py:0
#. module: sale_loyalty_incompatibility
#: code:addons/sale_loyalty_incompatibility/models/coupon_program.py:0
#: code:addons/sale_loyalty_incompatibility/models/sale_coupon.py:0
#, python-format
msgid ""
"This promotion is incompatible with other set already in the order so it "
Expand Down
3 changes: 1 addition & 2 deletions sale_loyalty_incompatibility/models/__init__.py
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
30 changes: 0 additions & 30 deletions sale_loyalty_incompatibility/models/sale_coupon.py

This file was deleted.

25 changes: 25 additions & 0 deletions sale_loyalty_incompatibility/models/sale_order.py
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
4 changes: 2 additions & 2 deletions sale_loyalty_incompatibility/readme/USAGE.rst
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.
18 changes: 9 additions & 9 deletions sale_loyalty_incompatibility/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>Coupon incompatibilities</title>
<title>Loyalty incompatibilities</title>
<style type="text/css">

/*
Expand Down Expand Up @@ -360,16 +360,16 @@
</style>
</head>
<body>
<div class="document" id="coupon-incompatibilities">
<h1 class="title">Coupon incompatibilities</h1>
<div class="document" id="loyalty-incompatibilities">
<h1 class="title">Loyalty incompatibilities</h1>

<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:5f10374003403bbcd364cf5e67d597e54a8528030be49132d4fda54d30f4df16
!! source digest: sha256:0a08b29a4c259fa45c1a162e2539bc400e9ecfa97b60f4fc878faca7dd3fb701
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/sale-promotion/tree/15.0/sale_coupon_incompatibility"><img alt="OCA/sale-promotion" src="https://img.shields.io/badge/github-OCA%2Fsale--promotion-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/sale-promotion-15-0/sale-promotion-15-0-sale_coupon_incompatibility"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/sale-promotion&amp;target_branch=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/sale-promotion/tree/16.0-mig-sale_coupon_incompatibility/sale_loyalty_incompatibility"><img alt="OCA/sale-promotion" src="https://img.shields.io/badge/github-OCA%2Fsale--promotion-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/sale-promotion-16-0-mig-sale_coupon_incompatibility/sale-promotion-16-0-mig-sale_coupon_incompatibility-sale_loyalty_incompatibility"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/sale-promotion&amp;target_branch=16.0-mig-sale_coupon_incompatibility"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module allows to set incompatibilities between promotions, so when a promotion A
is not compatible with promotion B, they can’t be applied together in a sales order.</p>
<p><strong>Table of contents</strong></p>
Expand All @@ -390,16 +390,16 @@ <h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
<p>Once you’ve configured your incompatibilities, go to a quotations that fulfills your
incompatible promotions and try to set them altogether.</p>
<ul class="simple">
<li>A coupon program with no code, won’t be applied.</li>
<li>A coupon or program code, will raise an error.</li>
<li>A loyalty program with no code, won’t be applied.</li>
<li>A loyalty or program code, will raise an error.</li>
</ul>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/sale-promotion/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/sale-promotion/issues/new?body=module:%20sale_coupon_incompatibility%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/sale-promotion/issues/new?body=module:%20sale_loyalty_incompatibility%0Aversion:%2016.0-mig-sale_coupon_incompatibility%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand Down Expand Up @@ -430,7 +430,7 @@ <h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/chienandalu"><img alt="chienandalu" src="https://github.com/chienandalu.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/sale-promotion/tree/15.0/sale_coupon_incompatibility">OCA/sale-promotion</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/sale-promotion/tree/16.0-mig-sale_coupon_incompatibility/sale_loyalty_incompatibility">OCA/sale-promotion</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
from odoo.exceptions import UserError
from odoo.tests import Form

from odoo.addons.coupon_incompatibility.tests.test_coupon_incompatibility import (
CouponIncompatibilityCase,
from odoo.addons.loyalty_incompatibility.tests.test_loyalty_incompatibility import (
LoyaltyIncompatibilityCase,
)


class TestCouponIncompatibility(CouponIncompatibilityCase):
class TestLoyaltyIncompatibility(LoyaltyIncompatibilityCase):
def _create_coupon_program(self, product=False, code=False, apply_on_order=True):
"""Helper method to create coupon programs in the tests cases"""
coupon_program_form = Form(
Expand Down

0 comments on commit dc2d711

Please sign in to comment.