Skip to content

Commit d4f063e

Browse files
[MIG] sale_coupon_incompatibility: Migration to 16.0 and rename to sale_loyalty_incompatibility
1 parent 93bd0bb commit d4f063e

File tree

14 files changed

+127
-184
lines changed

14 files changed

+127
-184
lines changed

sale_loyalty_incompatibility/README.rst

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
========================
2-
Coupon incompatibilities
3-
========================
1+
=========================
2+
Loyalty incompatibilities
3+
=========================
44

55
..
66
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
77
!! This file is generated by oca-gen-addon-readme !!
88
!! changes will be overwritten. !!
99
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10-
!! source digest: sha256:5f10374003403bbcd364cf5e67d597e54a8528030be49132d4fda54d30f4df16
10+
!! source digest: sha256:0a08b29a4c259fa45c1a162e2539bc400e9ecfa97b60f4fc878faca7dd3fb701
1111
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1212
1313
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
@@ -17,13 +17,13 @@ Coupon incompatibilities
1717
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
1818
:alt: License: AGPL-3
1919
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsale--promotion-lightgray.png?logo=github
20-
:target: https://github.com/OCA/sale-promotion/tree/15.0/sale_coupon_incompatibility
20+
:target: https://github.com/OCA/sale-promotion/tree/16.0-mig-sale_coupon_incompatibility/sale_loyalty_incompatibility
2121
:alt: OCA/sale-promotion
2222
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23-
:target: https://translation.odoo-community.org/projects/sale-promotion-15-0/sale-promotion-15-0-sale_coupon_incompatibility
23+
: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
2424
:alt: Translate me on Weblate
2525
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26-
:target: https://runboat.odoo-community.org/builds?repo=OCA/sale-promotion&target_branch=15.0
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/sale-promotion&target_branch=16.0-mig-sale_coupon_incompatibility
2727
:alt: Try me on Runboat
2828

2929
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -42,16 +42,16 @@ Usage
4242
Once you've configured your incompatibilities, go to a quotations that fulfills your
4343
incompatible promotions and try to set them altogether.
4444

45-
- A coupon program with no code, won't be applied.
46-
- A coupon or program code, will raise an error.
45+
- A loyalty program with no code, won't be applied.
46+
- A loyalty or program code, will raise an error.
4747

4848
Bug Tracker
4949
===========
5050

5151
Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-promotion/issues>`_.
5252
In case of trouble, please check there if your issue has already been reported.
5353
If you spotted it first, help us to smash it by providing a detailed and welcomed
54-
`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**>`_.
54+
`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**>`_.
5555

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

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

9494
|maintainer-chienandalu|
9595

96-
This module is part of the `OCA/sale-promotion <https://github.com/OCA/sale-promotion/tree/15.0/sale_coupon_incompatibility>`_ project on GitHub.
96+
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.
9797

9898
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# Copyright 2021 Tecnativa - David Vidal
22
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
33
{
4-
"name": "Coupon incompatibilities",
4+
"name": "Loyalty incompatibilities",
55
"summary": "Allows to set incompatibility rules between promotions",
6-
"version": "15.0.1.0.0",
6+
"version": "16.0.1.0.0",
77
"development_status": "Production/Stable",
88
"category": "Sale",
99
"website": "https://github.com/OCA/sale-promotion",
1010
"author": "Tecnativa, Odoo Community Association (OCA)",
1111
"maintainers": ["chienandalu"],
1212
"license": "AGPL-3",
13-
"depends": ["sale_coupon", "coupon_incompatibility"],
13+
"depends": ["loyalty_incompatibility", "sale_loyalty"],
1414
}

sale_loyalty_incompatibility/i18n/es.po

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Translation of Odoo Server.
22
# This file contains the translation of the following modules:
3-
# * sale_coupon_incompatibility
3+
# * sale_loyalty_incompatibility
44
#
55
msgid ""
66
msgstr ""
@@ -17,19 +17,19 @@ msgstr ""
1717
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
1818
"X-Generator: Poedit 3.2.2\n"
1919

20-
#. module: sale_coupon_incompatibility
21-
#: model:ir.model,name:sale_coupon_incompatibility.model_coupon_coupon
20+
#. module: sale_loyalty_incompatibility
21+
#: model:ir.model,name:sale_loyalty_incompatibility.model_coupon_coupon
2222
msgid "Coupon"
2323
msgstr "Cupón"
2424

25-
#. module: sale_coupon_incompatibility
26-
#: model:ir.model,name:sale_coupon_incompatibility.model_coupon_program
25+
#. module: sale_loyalty_incompatibility
26+
#: model:ir.model,name:sale_loyalty_incompatibility.model_coupon_program
2727
msgid "Coupon display on a website"
2828
msgstr ""
2929

30-
#. module: sale_coupon_incompatibility
31-
#: code:addons/sale_coupon_incompatibility/models/coupon_program.py:0
32-
#: code:addons/sale_coupon_incompatibility/models/sale_coupon.py:0
30+
#. module: sale_loyalty_incompatibility
31+
#: code:addons/sale_loyalty_incompatibility/models/coupon_program.py:0
32+
#: code:addons/sale_loyalty_incompatibility/models/sale_coupon.py:0
3333
#, python-format
3434
msgid ""
3535
"This promotion is incompatible with other set already in the order so it "

sale_loyalty_incompatibility/i18n/sale_coupon_incompatibility.pot sale_loyalty_incompatibility/i18n/sale_loyalty_incompatibility.pot

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Translation of Odoo Server.
22
# This file contains the translation of the following modules:
3-
# * sale_coupon_incompatibility
3+
# * sale_loyalty_incompatibility
44
#
55
msgid ""
66
msgstr ""
@@ -13,19 +13,19 @@ msgstr ""
1313
"Content-Transfer-Encoding: \n"
1414
"Plural-Forms: \n"
1515

16-
#. module: sale_coupon_incompatibility
17-
#: model:ir.model,name:sale_coupon_incompatibility.model_coupon_coupon
16+
#. module: sale_loyalty_incompatibility
17+
#: model:ir.model,name:sale_loyalty_incompatibility.model_coupon_coupon
1818
msgid "Coupon"
1919
msgstr ""
2020

21-
#. module: sale_coupon_incompatibility
22-
#: model:ir.model,name:sale_coupon_incompatibility.model_coupon_program
21+
#. module: sale_loyalty_incompatibility
22+
#: model:ir.model,name:sale_loyalty_incompatibility.model_coupon_program
2323
msgid "Coupon display on a website"
2424
msgstr ""
2525

26-
#. module: sale_coupon_incompatibility
27-
#: code:addons/sale_coupon_incompatibility/models/coupon_program.py:0
28-
#: code:addons/sale_coupon_incompatibility/models/sale_coupon.py:0
26+
#. module: sale_loyalty_incompatibility
27+
#: code:addons/sale_loyalty_incompatibility/models/coupon_program.py:0
28+
#: code:addons/sale_loyalty_incompatibility/models/sale_coupon.py:0
2929
#, python-format
3030
msgid ""
3131
"This promotion is incompatible with other set already in the order so it "
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
from . import coupon_program
2-
from . import sale_coupon
1+
from . import sale_order

sale_loyalty_incompatibility/models/coupon_program.py

-27
This file was deleted.

sale_loyalty_incompatibility/models/sale_coupon.py

-30
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright 2021 Tecnativa - David Vidal
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
from odoo import _, models
4+
5+
6+
class SaleOrder(models.Model):
7+
_inherit = "sale.order"
8+
9+
def _program_check_compute_points(self, programs):
10+
"""Coupon incompatibility rules. Check the error strings for a detailed case
11+
detail."""
12+
self.ensure_one()
13+
result = super()._program_check_compute_points(programs)
14+
order_programs = self.order_line.reward_id.program_id
15+
for program in result:
16+
if any({x in order_programs for x in program.incompatible_promotion_ids}):
17+
result[program] = {
18+
"error": _(
19+
"This promotion is incompatible with other set already in the "
20+
"order so it can't be applied."
21+
)
22+
}
23+
return result
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Once you've configured your incompatibilities, go to a quotations that fulfills your
22
incompatible promotions and try to set them altogether.
33

4-
- A coupon program with no code, won't be applied.
5-
- A coupon or program code, will raise an error.
4+
- A loyalty program with no code, won't be applied.
5+
- A loyalty or program code, will raise an error.

sale_loyalty_incompatibility/static/description/index.html

+9-9
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<head>
55
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
66
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
7-
<title>Coupon incompatibilities</title>
7+
<title>Loyalty incompatibilities</title>
88
<style type="text/css">
99

1010
/*
@@ -360,16 +360,16 @@
360360
</style>
361361
</head>
362362
<body>
363-
<div class="document" id="coupon-incompatibilities">
364-
<h1 class="title">Coupon incompatibilities</h1>
363+
<div class="document" id="loyalty-incompatibilities">
364+
<h1 class="title">Loyalty incompatibilities</h1>
365365

366366
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
367367
!! This file is generated by oca-gen-addon-readme !!
368368
!! changes will be overwritten. !!
369369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370-
!! source digest: sha256:5f10374003403bbcd364cf5e67d597e54a8528030be49132d4fda54d30f4df16
370+
!! source digest: sha256:0a08b29a4c259fa45c1a162e2539bc400e9ecfa97b60f4fc878faca7dd3fb701
371371
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
372-
<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>
372+
<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>
373373
<p>This module allows to set incompatibilities between promotions, so when a promotion A
374374
is not compatible with promotion B, they can’t be applied together in a sales order.</p>
375375
<p><strong>Table of contents</strong></p>
@@ -390,16 +390,16 @@ <h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
390390
<p>Once you’ve configured your incompatibilities, go to a quotations that fulfills your
391391
incompatible promotions and try to set them altogether.</p>
392392
<ul class="simple">
393-
<li>A coupon program with no code, won’t be applied.</li>
394-
<li>A coupon or program code, will raise an error.</li>
393+
<li>A loyalty program with no code, won’t be applied.</li>
394+
<li>A loyalty or program code, will raise an error.</li>
395395
</ul>
396396
</div>
397397
<div class="section" id="bug-tracker">
398398
<h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
399399
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/sale-promotion/issues">GitHub Issues</a>.
400400
In case of trouble, please check there if your issue has already been reported.
401401
If you spotted it first, help us to smash it by providing a detailed and welcomed
402-
<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>
402+
<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>
403403
<p>Do not contact contributors directly about support or help with technical issues.</p>
404404
</div>
405405
<div class="section" id="credits">
@@ -430,7 +430,7 @@ <h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
430430
promote its widespread use.</p>
431431
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
432432
<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>
433-
<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>
433+
<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>
434434
<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>
435435
</div>
436436
</div>

0 commit comments

Comments
 (0)