Skip to content

Commit 1b0a467

Browse files
author
shopinvader-git-bot
committed
Merge PR #1631 into 18.0
Signed-off-by sebastienbeau
2 parents 78590d8 + a8caad6 commit 1b0a467

32 files changed

Lines changed: 398 additions & 298 deletions

.pre-commit-config.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,38 @@ exclude: |
22
(?x)
33
# NOT INSTALLABLE ADDONS
44
^shopinvader_api_sale_loyalty/|
5+
^sale_cart/|
6+
^sale_cart_step/|
7+
^sale_quotation/|
8+
^shopinvader_address/|
9+
^shopinvader_address_shipping_note/|
10+
^shopinvader_anonymous_partner/|
11+
^shopinvader_api_address/|
12+
^shopinvader_api_address_shipping_note/|
13+
^shopinvader_api_cart/|
14+
^shopinvader_api_cart_cancel/|
15+
^shopinvader_api_cart_options/|
16+
^shopinvader_api_cart_step/|
17+
^shopinvader_api_customer/|
18+
^shopinvader_api_invoice/|
19+
^shopinvader_api_lead/|
20+
^shopinvader_api_quotation/|
21+
^shopinvader_api_sale/|
22+
^shopinvader_api_security_invoice/|
23+
^shopinvader_api_security_sale/|
24+
^shopinvader_api_settings/|
25+
^shopinvader_api_signin_jwt/|
26+
^shopinvader_api_wishlist/|
27+
^shopinvader_delivery_state/|
28+
^shopinvader_fastapi_auth_jwt/|
29+
^shopinvader_fastapi_auth_partner/|
30+
^shopinvader_sale_cart/|
31+
^shopinvader_sale_cart_anonymous_partner/|
32+
^shopinvader_sale_state/|
33+
^shopinvader_schema_address/|
34+
^shopinvader_schema_invoice/|
35+
^shopinvader_schema_sale/|
36+
^shopinvader_schema_sale_state/|
537
# END NOT INSTALLABLE ADDONS
638
# Files and folders generated by bots, to avoid loops
739
^setup/|/static/description/index\.html$|
Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
.. image:: https://odoo-community.org/readme-banner-image
2-
:target: https://odoo-community.org/get-involved?utm_source=readme
3-
:alt: Odoo Community Association
4-
51
============================
62
Shopinvader API Sale Loyalty
73
============================
@@ -17,28 +13,35 @@ Shopinvader API Sale Loyalty
1713
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
1814
:target: https://odoo-community.org/page/development-status
1915
:alt: Beta
20-
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
2117
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
2218
:alt: License: AGPL-3
2319
.. |badge3| image:: https://img.shields.io/badge/github-shopinvader%2Fodoo--shopinvader-lightgray.png?logo=github
24-
:target: https://github.com/shopinvader/odoo-shopinvader/tree/16.0/shopinvader_api_sale_loyalty
20+
:target: https://github.com/shopinvader/odoo-shopinvader/tree/18.0/shopinvader_api_sale_loyalty
2521
:alt: shopinvader/odoo-shopinvader
2622

2723
|badge1| |badge2| |badge3|
2824

2925
This module extends the functionality of Shopinvader to support Coupons
30-
and Promotions from `sale_loyalty` core module.
31-
It is the new version providing FastAPI services.
26+
and Promotions from sale_loyalty core module. It is the new version
27+
providing FastAPI services.
3228

33-
Not to be confused with `shopinvader_promotion_rule`, that implements
34-
promotion programs from OCA module `sale_promotion_rule`, an alternative
35-
to the core `sale_loyalty` module.
29+
Not to be confused with shopinvader_promotion_rule, that implements
30+
promotion programs from OCA module sale_promotion_rule, an alternative
31+
to the core sale_loyalty module.
3632

3733
Available services:
3834

39-
* ``/loyalty/{code}`` under the ``loyalty`` router, to get all rewards claimable with a given coupon code
40-
* ``/coupon`` under the ``cart`` router, to apply a given coupon to the cart. Allows to specify which reward and/or which free product to offer.
41-
* ``/reward`` under the ``cart`` router, to apply a given reward (automatic promotion). Note that automatic promotions are applied automatically at cart update, when possible (if no choice must be done). This service allows to apply an automatic promotion for which the reward/free product choice is mandatory.
35+
- ``/loyalty/{code}`` under the ``loyalty`` router, to get all rewards
36+
claimable with a given coupon code
37+
- ``/coupon`` under the ``cart`` router, to apply a given coupon to the
38+
cart. Allows to specify which reward and/or which free product to
39+
offer.
40+
- ``/reward`` under the ``cart`` router, to apply a given reward
41+
(automatic promotion). Note that automatic promotions are applied
42+
automatically at cart update, when possible (if no choice must be
43+
done). This service allows to apply an automatic promotion for which
44+
the reward/free product choice is mandatory.
4245

4346
**Table of contents**
4447

@@ -48,50 +51,49 @@ Available services:
4851
Usage
4952
=====
5053

51-
This addons provides 2 new routers: `loyalty_router` and
52-
`sale_loyalty_cart_router`. The `sale_loyalty_cart_router` is declared
53-
with the same tags as the one defined in the `shopinvader_api_cart`
54-
addon. As this one, no prefix is added to the router, to allow to mount
55-
it as a nested app. See the README of `shopinvader_api_cart` for
56-
more details on how to do it.
54+
This addons provides 2 new routers: loyalty_router and
55+
sale_loyalty_cart_router. The sale_loyalty_cart_router is declared with
56+
the same tags as the one defined in the shopinvader_api_cart addon. As
57+
this one, no prefix is added to the router, to allow to mount it as a
58+
nested app. See the README of shopinvader_api_cart for more details on
59+
how to do it.
5760

5861
As all api addons, installing this addon will not have any effect on the
5962
existing fastapi app. You must add the routers to the app by yourself by
6063
editing your fastapi.endpoint where you want to add the routes.
6164

62-
6365
Bug Tracker
6466
===========
6567

6668
Bugs are tracked on `GitHub Issues <https://github.com/shopinvader/odoo-shopinvader/issues>`_.
6769
In case of trouble, please check there if your issue has already been reported.
6870
If you spotted it first, help us to smash it by providing a detailed and welcomed
69-
`feedback <https://github.com/shopinvader/odoo-shopinvader/issues/new?body=module:%20shopinvader_api_sale_loyalty%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
71+
`feedback <https://github.com/shopinvader/odoo-shopinvader/issues/new?body=module:%20shopinvader_api_sale_loyalty%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
7072

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

7375
Credits
7476
=======
7577

7678
Authors
77-
~~~~~~~
79+
-------
7880

7981
* ACSONE SA/NV
8082

8183
Contributors
82-
~~~~~~~~~~~~
84+
------------
8385

84-
* `Camptocamp <https://www.camptocamp.com>`_
86+
- `Camptocamp <https://www.camptocamp.com>`__
8587

86-
* Iván Todorovich <ivan.todorovich@gmail.com>
88+
- Iván Todorovich <ivan.todorovich@gmail.com>
8789

88-
* `Acsone <https://www.acsone.eu>`_
90+
- `Acsone <https://www.acsone.eu>`__
8991

90-
* Marie Lejeune <marie.lejeune@acsone.eu>
92+
- Marie Lejeune <marie.lejeune@acsone.eu>
9193

9294
Maintainers
93-
~~~~~~~~~~~
95+
-----------
9496

95-
This module is part of the `shopinvader/odoo-shopinvader <https://github.com/shopinvader/odoo-shopinvader/tree/16.0/shopinvader_api_sale_loyalty>`_ project on GitHub.
97+
This module is part of the `shopinvader/odoo-shopinvader <https://github.com/shopinvader/odoo-shopinvader/tree/18.0/shopinvader_api_sale_loyalty>`_ project on GitHub.
9698

9799
You are welcome to contribute.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
from . import models
12
from . import routers

shopinvader_api_sale_loyalty/__manifest__.py

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,41 +3,31 @@
33

44
{
55
"name": "Shopinvader API Sale Loyalty",
6-
"summary": """
7-
FastAPI services to add coupons and loyalties to carts.""",
8-
"version": "16.0.1.2.0",
6+
"summary": "FastAPI services to add coupons and loyalties to carts.",
7+
"version": "18.0.1.0.0",
98
"license": "AGPL-3",
109
"author": "ACSONE SA/NV",
1110
"website": "https://github.com/shopinvader/odoo-shopinvader",
1211
"depends": [
1312
"sale_loyalty",
1413
"sale_loyalty_order_info",
1514
"shopinvader_api_cart",
16-
"shopinvader_api_security_sale",
17-
"shopinvader_schema_sale",
1815
"pydantic",
19-
"extendable",
20-
"fastapi",
2116
"extendable_fastapi",
2217
],
2318
"data": [
2419
"security/groups.xml",
2520
"security/acl_loyalty_card.xml",
21+
"security/acl_loyalty_history.xml",
2622
"security/acl_loyalty_program.xml",
2723
"security/acl_loyalty_reward.xml",
2824
"security/acl_loyalty_rule.xml",
2925
"security/acl_product_product.xml",
3026
"security/acl_product_tag.xml",
27+
"security/acl_account_tax.xml",
28+
"security/acl_account_tax_repartition_line.xml",
3129
"security/acl_sale_order_coupon_points.xml",
3230
"security/acl_sale_loyalty_reward_wizard.xml",
3331
],
34-
"external_dependencies": {
35-
"python": [
36-
"fastapi",
37-
"pydantic>=2.0.0",
38-
"extendable-pydantic>=1.2.0",
39-
],
40-
'installable': False,
41-
},
42-
'installable': False,
32+
"installable": True,
4333
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import sale_order
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright 2026 Akretion (http://www.akretion.com).
2+
# @author Florian Mounier <florian.mounier@akretion.com>
3+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
4+
5+
from odoo import models
6+
7+
8+
class SaleOrder(models.Model):
9+
_inherit = "sale.order"
10+
11+
def _get_program_timezone(self):
12+
# Workaround security issue
13+
if self.env.user.has_group(
14+
"shopinvader_api_security_sale.shopinvader_sale_user_group"
15+
):
16+
sudo_tz = self.company_id.sudo().partner_id.tz
17+
if sudo_tz:
18+
return sudo_tz
19+
return super()._get_program_timezone()
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["whool"]
3+
build-backend = "whool.buildapi"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- [Camptocamp](https://www.camptocamp.com)
2+
- Iván Todorovich \<ivan.todorovich@gmail.com\>
3+
- [Acsone](https://www.acsone.eu)
4+
- Marie Lejeune \<marie.lejeune@acsone.eu\>

shopinvader_api_sale_loyalty/readme/CONTRIBUTORS.rst

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
This module extends the functionality of Shopinvader to support Coupons
2+
and Promotions from sale_loyalty core module. It is the new version
3+
providing FastAPI services.
4+
5+
Not to be confused with shopinvader_promotion_rule, that implements
6+
promotion programs from OCA module sale_promotion_rule, an alternative
7+
to the core sale_loyalty module.
8+
9+
Available services:
10+
11+
- `/loyalty/{code}` under the `loyalty` router, to get all rewards
12+
claimable with a given coupon code
13+
- `/coupon` under the `cart` router, to apply a given coupon to the
14+
cart. Allows to specify which reward and/or which free product to
15+
offer.
16+
- `/reward` under the `cart` router, to apply a given reward (automatic
17+
promotion). Note that automatic promotions are applied automatically
18+
at cart update, when possible (if no choice must be done). This
19+
service allows to apply an automatic promotion for which the
20+
reward/free product choice is mandatory.

0 commit comments

Comments
 (0)