Skip to content

Commit

Permalink
[ADD] delivery_deliverea: This module allows integration with deliverea
Browse files Browse the repository at this point in the history
  • Loading branch information
OscarIndias committed Oct 9, 2023
1 parent ba85ba8 commit 1f96a90
Show file tree
Hide file tree
Showing 45 changed files with 5,446 additions and 0 deletions.
151 changes: 151 additions & 0 deletions delivery_deliverea/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
==================
Delivery Deliverea
==================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:c394bcf2eb7b913e035898f5095ee5a394ebb9ca965716169fe1aa691f69cd26
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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-OCA%2Fdelivery--carrier-lightgray.png?logo=github
:target: https://github.com/OCA/delivery-carrier/tree/16.0/delivery_deliverea
:alt: OCA/delivery-carrier
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/delivery-carrier-16-0/delivery-carrier-16-0-delivery_deliverea
: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/delivery-carrier&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

Deliverea API intration with Odoo.

**Table of contents**

.. contents::
:local:

Installation
============

This module needs the `unidecode` python library.

It depends on the modules:

* `base_delivery_carrier_label <https://github.com/OCA/delivery-carrier/tree/16.0/base_delivery_carrier_label>`_ repositorio OCA/delivery-carrier
* `delivery_package_number <https://github.com/OCA/delivery-carrier/tree/16.0/delivery_package_number>`_ repositorio OCA/delivery-carrier
* `delivery_state <https://github.com/OCA/delivery-carrier/tree/16.0/delivery_state>`_ repositorio OCA/delivery-carrier
* `queue_job <https://github.com/OCA/queue/tree/16.0/queue_job>`_ repositorio OCA/queue

Configuration
=============

To configure your Deliverea services, go to:

- *Inventory > Configuration > Delivery methods* and create a new one.
- Choose *Deliverea* as provider.
- Configure your Deliverea credentials: user and password.
- You can configure the next fields:
* Deliverea production environment URL
* Deliverea test environment URL
* Deliverea tracking URL
* Deliverea Distribution Center
* Deliverea carrier
* Deliverea carrier service
* Deliverea articles description
* Select note field
* Notify by sms
* Notify by email
* Hide sender
* Return label
* Return proof delivery
* Saturday delivery

Usage
=====

Shipping codes are generated when a stock pick is validated whose carrier is configured
for Deliverea as a supplier is validated.
for Deliverea as a supplier is validated. The label is generated and attached to the
the document according to the previously configured label generation parameters.

In case you accidentally delete the attached label, you can generate it again by
clicking on the *Deliverea button. On the *Deliverea Label* button at the top of the
picking form.

In order to select the Deliverea distribution center you have to click on the Import
distribution centers button, which will import all available distribution centers.

In order to select the type of carrier and the type of service to be used for this
shipping method, click on the Import carriers and services button.

Once the distribution centers and services are imported, we can select them in the
fields.

Known issues / Roadmap
======================

* No specified roadmap and no known problems in operation.

Changelog
=========

16.0.1.0.0 (2023-06-07)
~~~~~~~~~~~~~~~~~~~~~~~

* Start of the history

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/delivery-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/OCA/delivery-carrier/issues/new?body=module:%20delivery_deliverea%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
~~~~~~~

* FactorLibre

Contributors
~~~~~~~~~~~~

* `FactorLibre <https://factorlibre.com>`_:

* Jorge Martínez <[email protected]>
* Zahra Velasco <[email protected]>
* Nacho Morales <[email protected]>
* Oscar Indias <[email protected]>

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/delivery-carrier <https://github.com/OCA/delivery-carrier/tree/16.0/delivery_deliverea>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions delivery_deliverea/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import controllers
from . import models
31 changes: 31 additions & 0 deletions delivery_deliverea/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright 2022 FactorLibre - Jorge Martínez <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
{
"name": "Delivery Deliverea",
"summary": "Delivery Carrier implementation for Deliverea using their API",
"version": "16.0.1.0.0",
"category": "Stock",
"website": "https://github.com/OCA/delivery-carrier",
"author": "FactorLibre, Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": [
"base_delivery_carrier_label",
"delivery_state",
"queue_job",
"delivery_package_number",
],
"external_dependencies": {"python": ["unidecode"]},
"data": [
"data/deliverea_states_data.xml",
"data/product_packaging_data.xml",
"data/ir_cron.xml",
"data/queue_job_data.xml",
"security/ir.model.access.csv",
"views/deliverea_distribution_center_views.xml",
"views/deliverea_state_mapping.xml",
"views/delivery_carrier_views.xml",
"views/stock_picking_views.xml",
],
}
2 changes: 2 additions & 0 deletions delivery_deliverea/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import main
from . import http
27 changes: 27 additions & 0 deletions delivery_deliverea/controllers/http.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# © 2022 FactorLibre - Asier Neira <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
import json

from odoo.http import JsonRPCDispatcher

# Add @http.route where data parsing is required
ROUTES = ["/deliverea-tracking-webhook"]


__original___init__ = JsonRPCDispatcher.__init__


def __init__(self, request):
if request and request.httprequest.path in ROUTES:
data = {
"data": json.loads(
request.httprequest.data.decode(request.httprequest.charset or "utf-8")
)
}
request.httprequest.data = request.httprequest._cached_data = json.dumps(
data
).encode(request.httprequest.charset or "utf-8")
__original___init__(self, request=request)


JsonRPCDispatcher.__init__ = __init__
32 changes: 32 additions & 0 deletions delivery_deliverea/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# © 2022 - FactorLibre - Jore Martínez <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import json

# from odoo.addons.queue_job.job import job
from odoo import http
from odoo.http import request


class DelivereaWebhook(http.Controller):
@http.route(
["/deliverea-tracking-webhook"],
type="json",
auth="public",
methods=["POST"],
csrf=False,
no_jsonrpc=True,
)
def order_import_webhook(self, **post):
SudoStockPicking = request.env["stock.picking"].sudo()
data = json.loads(request.httprequest.data)
for line in data.get("data"):
SudoStockPicking.with_delay().deliverea_update_tracking_state(line)
return self.return_response("Tracking OK")

@staticmethod
def return_response(msg, code=200):
return http.Response(
json.dumps({"message": msg, "status": code}),
code,
headers=[("Content-Type", "application/json")],
)
Loading

0 comments on commit 1f96a90

Please sign in to comment.