-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[16.0][MIG] shopinvader_delivery_pickup_colissimo_widget
- Loading branch information
1 parent
e961c84
commit e6126bf
Showing
22 changed files
with
612 additions
and
109 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# addons listed in this file are ignored by | ||
# setuptools-odoo-make-default (one addon per line) |
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,2 @@ | ||
To learn more about this directory, please visit | ||
https://pypi.python.org/pypi/setuptools-odoo |
1 change: 1 addition & 0 deletions
1
...very_pickup_colissimo_widget/odoo/addons/shopinvader_api_delivery_pickup_colissimo_widget
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 @@ | ||
../../../../shopinvader_api_delivery_pickup_colissimo_widget |
6 changes: 6 additions & 0 deletions
6
setup/shopinvader_api_delivery_pickup_colissimo_widget/setup.py
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,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |
77 changes: 77 additions & 0 deletions
77
shopinvader_api_delivery_pickup_colissimo_widget/README.rst
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,77 @@ | ||
============================ | ||
Shopinvader Pickup Colissimo | ||
============================ | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:33018a07e970ac37422c211d6868173b5d18970b11eef184ca9f565876e50d42 | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png | ||
:target: https://odoo-community.org/page/development-status | ||
:alt: Beta | ||
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
.. |badge3| image:: https://img.shields.io/badge/github-shopinvader%2Fodoo--shopinvader--carrier-lightgray.png?logo=github | ||
:target: https://github.com/shopinvader/odoo-shopinvader-carrier/tree/16.0/shopinvader_api_delivery_pickup_colissimo_widget | ||
:alt: shopinvader/odoo-shopinvader-carrier | ||
|
||
|badge1| |badge2| |badge3| | ||
|
||
This is shopinvader the odoo module for the new generation of e-commerce. | ||
|
||
This module add the support of la poste dropoff site with the solution "Front PagePointRetrait". | ||
|
||
See documentation here: | ||
.. _Front Page Point Relais: https://www.colissimo.entreprise.laposte.fr/fr/system/files/imagescontent/docs/FPPR-FR.pdf | ||
|
||
|
||
.. _Shopinvader: https://shopinvader.com | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/shopinvader/odoo-shopinvader-carrier/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/shopinvader/odoo-shopinvader-carrier/issues/new?body=module:%20shopinvader_api_delivery_pickup_colissimo_widget%0Aversion:%2016.0%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. | ||
|
||
Credits | ||
======= | ||
|
||
Authors | ||
~~~~~~~ | ||
|
||
* Akretion | ||
* Shopinvader | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* Sebastien BEAU <[email protected]> | ||
* Chafique DELLI <[email protected]> | ||
|
||
Other credits | ||
~~~~~~~~~~~~~ | ||
|
||
The development of this module has been financially supported by: | ||
|
||
* Akretion | ||
|
||
Maintainers | ||
~~~~~~~~~~~ | ||
|
||
This module is part of the `shopinvader/odoo-shopinvader-carrier <https://github.com/shopinvader/odoo-shopinvader-carrier/tree/16.0/shopinvader_api_delivery_pickup_colissimo_widget>`_ project on GitHub. | ||
|
||
You are welcome to contribute. |
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 @@ | ||
from . import routers |
18 changes: 9 additions & 9 deletions
18
...y_pickup_colissimo_widget/__manifest__.py → ...y_pickup_colissimo_widget/__manifest__.py
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,24 +1,24 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2019 Akretion (http://www.akretion.com) | ||
# Sébastien BEAU <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
{ | ||
"name": "Shopinvader Dropoff site Public Edition", | ||
"summary": "Shopinvader Dropoff site Public Edition", | ||
"version": "10.0.0.0.0", | ||
"name": "Shopinvader Pickup Colissimo", | ||
"summary": "Shopinvader Pickup Colissimo", | ||
"version": "16.0.1.0.0", | ||
"category": "e-commerce", | ||
"website": "https://akretion.com", | ||
"author": "Akretion", | ||
"website": "https://github.com/shopinvader/odoo-shopinvader-carrier", | ||
"author": "Akretion, Shopinvader", | ||
"license": "AGPL-3", | ||
"application": False, | ||
"installable": True, | ||
"external_dependencies": {"python": [], "bin": []}, | ||
"depends": [ | ||
"shopinvader_delivery_pickup_public_edition", | ||
"delivery_roulier_laposte", | ||
"shopinvader_api_delivery_pickup", | ||
], | ||
"data": [ | ||
"data/ir_config_parameter_data.xml", | ||
], | ||
"data": [], | ||
"demo": [], | ||
"qweb": [], | ||
} |
15 changes: 15 additions & 0 deletions
15
shopinvader_api_delivery_pickup_colissimo_widget/data/ir_config_parameter_data.xml
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,15 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo noupdate="1"> | ||
|
||
<!-- Login for Laposte Account --> | ||
<record id="laposte_account_user" model="ir.config_parameter"> | ||
<field name="key">laposte.user</field> | ||
<field name="value" /> | ||
</record> | ||
<!-- Password for Laposte Account --> | ||
<record id="laposte_account_password" model="ir.config_parameter"> | ||
<field name="key">laposte.password</field> | ||
<field name="value" /> | ||
</record> | ||
|
||
</odoo> |
1 change: 1 addition & 0 deletions
1
..._colissimo_widget/readme/CONTRIBUTORS.rst → ..._colissimo_widget/readme/CONTRIBUTORS.rst
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 +1,2 @@ | ||
* Sebastien BEAU <[email protected]> | ||
* Chafique DELLI <[email protected]> |
File renamed without changes.
File renamed without changes.
2 changes: 0 additions & 2 deletions
2
...kup_colissimo_widget/services/__init__.py → ...ckup_colissimo_widget/routers/__init__.py
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,3 +1 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from . import delivery_pickup |
61 changes: 61 additions & 0 deletions
61
shopinvader_api_delivery_pickup_colissimo_widget/routers/delivery_pickup.py
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,61 @@ | ||
# Copyright 2019 Akretion (http://www.akretion.com). | ||
# @author Sébastien BEAU <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
import logging | ||
from typing import Annotated | ||
|
||
import requests | ||
from fastapi import Depends, Request | ||
|
||
from odoo import _, api, models | ||
from odoo.exceptions import Warning as UserError | ||
|
||
from odoo.addons.fastapi.dependencies import odoo_env | ||
from odoo.addons.shopinvader_api_delivery_pickup.routers import delivery_pickup_router | ||
|
||
from ..schemas import DeliveryColissimoPickupToken | ||
|
||
_logger = logging.getLogger(__name__) | ||
|
||
LAPOSTE_API_ENDPOINT = "https://ws.colissimo.fr/widget-colissimo/rest/" | ||
|
||
|
||
@delivery_pickup_router.get("/delivery_pickups/providers/colissimo/token") | ||
def colissimo_token_return( | ||
request: Request, | ||
odoo_env: Annotated[api.Environment, Depends(odoo_env)], | ||
) -> DeliveryColissimoPickupToken: | ||
""" | ||
Returns the token for Laposte Account. | ||
""" | ||
login, password = odoo_env[ | ||
"shopinvader_api_delivery_pickup_colissimo_widget_router.helper" | ||
]._get_laposte_account() | ||
response = requests.post( | ||
LAPOSTE_API_ENDPOINT + "authenticate.rest", | ||
json={"login": login, "password": password}, | ||
timeout=3600, | ||
) | ||
if response.status_code == 200: | ||
return response.json() | ||
else: | ||
_logger.error("La poste error %s %s", response.status_code, response.text) | ||
raise UserError(_("Authentification Error with laposte")) | ||
|
||
|
||
class ShopinvaderApiDeliveryColissimoRouterHelper(models.AbstractModel): | ||
_name = "shopinvader_api_delivery_pickup_colissimo_widget_router.helper" | ||
_description = "ShopInvader API Delivery Pickup Colissimo Router Helper" | ||
|
||
def _get_laposte_account(self): | ||
login = self.env["ir.config_parameter"].get_param("laposte.user") | ||
password = self.env["ir.config_parameter"].get_param("laposte.password") | ||
if not login or not password: | ||
raise UserError( | ||
_( | ||
"The login or password for your Laposte account " | ||
"has not been entered in the system settings" | ||
) | ||
) | ||
return login, password |
1 change: 1 addition & 0 deletions
1
shopinvader_api_delivery_pickup_colissimo_widget/schemas/__init__.py
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 @@ | ||
from .delivery_colissimo_pickup_token import DeliveryColissimoPickupToken |
8 changes: 8 additions & 0 deletions
8
shopinvader_api_delivery_pickup_colissimo_widget/schemas/delivery_colissimo_pickup_token.py
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,8 @@ | ||
# Copyright 2024 Akretion | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from extendable_pydantic import StrictExtendableBaseModel | ||
|
||
|
||
class DeliveryColissimoPickupToken(StrictExtendableBaseModel): | ||
token: str |
Oops, something went wrong.