-
-
Notifications
You must be signed in to change notification settings - Fork 362
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by bguillot
- Loading branch information
Showing
24 changed files
with
1,726 additions
and
0 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,139 @@ | ||
======================== | ||
Delivery Carrier Roulier | ||
======================== | ||
|
||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |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/14.0/delivery_roulier | ||
: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-14-0/delivery-carrier-14-0-delivery_roulier | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png | ||
:target: https://runbot.odoo-community.org/runbot/99/14.0 | ||
:alt: Try me on Runbot | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
Integration of multiple carriers with Roulier library | ||
|
||
Base module for integration with Roulier. | ||
|
||
`Roulier <https://pypi.python.org/pypi/roulier>`_ is a python library which implements carriers API. | ||
This modules contains the core functions for this implementation. | ||
|
||
You should install one of the specific modules : | ||
|
||
- delivery_roulier_laposte | ||
- delivery_roulier_dpd | ||
- delivery_roulier_geodis | ||
- delivery_carrier_label_gls | ||
- more to come | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Usage | ||
===== | ||
|
||
Here is some methods you can use for your carrier implementation | ||
allowing to have a consistent code accross different carrier modules: | ||
|
||
.. code-block:: python | ||
def _mycarrier_get_sender(...): | ||
def _mycarrier_get_receiver(...): | ||
def _mycarrier_get_shipping_date(...): | ||
def _mycarrier_get_account(...): | ||
def _mycarrier_get_auth(...): | ||
def _mycarrier_get_service(...): | ||
def _mycarrier_convert_address(...): | ||
| | ||
|
||
Instead of calling `super()` you can use: | ||
|
||
.. code-block:: python | ||
def _mycarrier_get_service(...): | ||
result = _roulier_get_service(...) | ||
result["specific_key"] = "blabla" | ||
return result | ||
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 smashing it by providing a detailed and welcomed | ||
`feedback <https://github.com/OCA/delivery-carrier/issues/new?body=module:%20delivery_roulier%0Aversion:%2014.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 | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* Raphaël Reverdy <[email protected]> | ||
* David Béal <[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. | ||
|
||
.. |maintainer-florian-dacosta| image:: https://github.com/florian-dacosta.png?size=40px | ||
:target: https://github.com/florian-dacosta | ||
:alt: florian-dacosta | ||
|
||
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__: | ||
|
||
|maintainer-florian-dacosta| | ||
|
||
This module is part of the `OCA/delivery-carrier <https://github.com/OCA/delivery-carrier/tree/14.0/delivery_roulier>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/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,3 @@ | ||
from . import models | ||
|
||
from .decorator import implemented_by_carrier |
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,27 @@ | ||
# @author Raphael Reverdy <[email protected]> | ||
# David BEAL <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
{ | ||
"name": "Delivery Carrier Roulier", | ||
"version": "16.0.1.0.0", | ||
"author": "Akretion,Odoo Community Association (OCA)", | ||
"summary": "Integration of multiple carriers", | ||
"maintainers": ["florian-dacosta"], | ||
"category": "Delivery", | ||
"depends": [ | ||
"base_delivery_carrier_label", | ||
"delivery_carrier_account", | ||
], | ||
"website": "https://github.com/OCA/delivery-carrier", | ||
"data": [], | ||
"demo": [ | ||
"demo/product.xml", | ||
], | ||
"external_dependencies": { | ||
"python": [ | ||
"roulier", # '>0.2.0' | ||
], | ||
}, | ||
"installable": True, | ||
"license": "AGPL-3", | ||
} |
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,42 @@ | ||
# @author Raphael Reverdy <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from functools import wraps | ||
|
||
|
||
def implemented_by_carrier(func): | ||
"""Decorator: call _carrier_prefixed method instead. | ||
Usage: | ||
@implemented_by_carrier | ||
def _do_something() | ||
def _laposte_do_something() | ||
def _gls_do_something() | ||
At runtime, picking._do_something() will try to call | ||
the carrier spectific method or fallback to generic _do_something | ||
""" | ||
|
||
@wraps(func) | ||
def wrapper(cls, *args, **kwargs): | ||
fun_name = func.__name__ | ||
|
||
def get_delivery_type(cls, *args, **kwargs): | ||
if hasattr(cls, "delivery_type"): | ||
return cls.delivery_type | ||
pickings = [ | ||
obj for obj in args if getattr(obj, "_name", "") == "stock.picking" | ||
] | ||
if len(pickings) > 0: | ||
return pickings[0].delivery_type | ||
if cls[0].carrier_id: | ||
return cls[0].carrier_id.delivery_type | ||
|
||
delivery_type = get_delivery_type(cls, *args, **kwargs) | ||
fun = "_{}{}".format(delivery_type, fun_name) | ||
if not hasattr(cls, fun): | ||
fun = "_roulier%s" % (fun_name) | ||
return getattr(cls, fun)(*args, **kwargs) | ||
|
||
return wrapper |
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,16 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
|
||
<!-- product.product --> | ||
<record id="product_big" model="product.product"> | ||
<field name="name">carrier 3.7 kg</field> | ||
<field name="type">product</field> | ||
<field name="weight">3.7</field> | ||
</record> | ||
<record id="product_small" model="product.product"> | ||
<field name="name">carrier 1.3 kg</field> | ||
<field name="type">product</field> | ||
<field name="weight">1.3</field> | ||
</record> | ||
|
||
</odoo> |
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,134 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * delivery_roulier | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 14.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"Last-Translator: \n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: delivery_roulier | ||
#: code:addons/delivery_roulier/models/stock_quant_package.py:0 | ||
#, python-format | ||
msgid "Bad input: %s\n" | ||
msgstr "" | ||
|
||
#. module: delivery_roulier | ||
#: model:ir.model.fields,field_description:delivery_roulier.field_stock_quant_package__carrier_id | ||
msgid "Carrier" | ||
msgstr "" | ||
|
||
#. module: delivery_roulier | ||
#: model:ir.model.fields,field_description:delivery_roulier.field_delivery_carrier__display_name | ||
#: model:ir.model.fields,field_description:delivery_roulier.field_stock_move_line__display_name | ||
#: model:ir.model.fields,field_description:delivery_roulier.field_stock_picking__display_name | ||
#: model:ir.model.fields,field_description:delivery_roulier.field_stock_quant_package__display_name | ||
msgid "Display Name" | ||
msgstr "" | ||
|
||
#. module: delivery_roulier | ||
#: model:ir.model.fields,field_description:delivery_roulier.field_delivery_carrier__id | ||
#: model:ir.model.fields,field_description:delivery_roulier.field_stock_move_line__id | ||
#: model:ir.model.fields,field_description:delivery_roulier.field_stock_picking__id | ||
#: model:ir.model.fields,field_description:delivery_roulier.field_stock_quant_package__id | ||
msgid "ID" | ||
msgstr "" | ||
|
||
#. module: delivery_roulier | ||
#: model:ir.model.fields,field_description:delivery_roulier.field_delivery_carrier____last_update | ||
#: model:ir.model.fields,field_description:delivery_roulier.field_stock_move_line____last_update | ||
#: model:ir.model.fields,field_description:delivery_roulier.field_stock_picking____last_update | ||
#: model:ir.model.fields,field_description:delivery_roulier.field_stock_quant_package____last_update | ||
msgid "Last Modified on" | ||
msgstr "" | ||
|
||
#. module: delivery_roulier | ||
#: code:addons/delivery_roulier/models/stock_picking.py:0 | ||
#, python-format | ||
msgid "No account available with name '%s' for this carrier" | ||
msgstr "" | ||
|
||
#. module: delivery_roulier | ||
#: code:addons/delivery_roulier/models/stock_picking.py:0 | ||
#, python-format | ||
msgid "No packages found for this picking" | ||
msgstr "" | ||
|
||
#. module: delivery_roulier | ||
#: model:ir.model,name:delivery_roulier.model_stock_quant_package | ||
msgid "Packages" | ||
msgstr "" | ||
|
||
#. module: delivery_roulier | ||
#: model:ir.model,name:delivery_roulier.model_stock_move_line | ||
msgid "Product Moves (Stock Move Line)" | ||
msgstr "" | ||
|
||
#. module: delivery_roulier | ||
#: code:addons/delivery_roulier/models/stock_quant_package.py:0 | ||
#, python-format | ||
msgid "" | ||
"Roulier library Exception for '%s' carrier:\n" | ||
"\n" | ||
"%s\n" | ||
"\n" | ||
"Sent data:\n" | ||
"%s" | ||
msgstr "" | ||
|
||
#. module: delivery_roulier | ||
#: model:ir.model,name:delivery_roulier.model_delivery_carrier | ||
msgid "Shipping Methods" | ||
msgstr "" | ||
|
||
#. module: delivery_roulier | ||
#: model_terms:ir.ui.view,arch_db:delivery_roulier.view_quant_package_form | ||
msgid "Tracking" | ||
msgstr "" | ||
|
||
#. module: delivery_roulier | ||
#: model:ir.model,name:delivery_roulier.model_stock_picking | ||
msgid "Transfer" | ||
msgstr "" | ||
|
||
#. module: delivery_roulier | ||
#: model:product.product,uom_name:delivery_roulier.product_big | ||
#: model:product.product,uom_name:delivery_roulier.product_small | ||
#: model:product.template,uom_name:delivery_roulier.product_big_product_template | ||
#: model:product.template,uom_name:delivery_roulier.product_small_product_template | ||
msgid "Units" | ||
msgstr "" | ||
|
||
#. module: delivery_roulier | ||
#: model:product.product,name:delivery_roulier.product_small | ||
#: model:product.template,name:delivery_roulier.product_small_product_template | ||
msgid "carrier 1.3 kg" | ||
msgstr "" | ||
|
||
#. module: delivery_roulier | ||
#: model:product.product,name:delivery_roulier.product_big | ||
#: model:product.template,name:delivery_roulier.product_big_product_template | ||
msgid "carrier 3.7 kg" | ||
msgstr "" | ||
|
||
#. module: delivery_roulier | ||
#: model:product.product,weight_uom_name:delivery_roulier.product_big | ||
#: model:product.product,weight_uom_name:delivery_roulier.product_small | ||
#: model:product.template,weight_uom_name:delivery_roulier.product_big_product_template | ||
#: model:product.template,weight_uom_name:delivery_roulier.product_small_product_template | ||
msgid "kg" | ||
msgstr "" | ||
|
||
#. module: delivery_roulier | ||
#: model:product.product,volume_uom_name:delivery_roulier.product_big | ||
#: model:product.product,volume_uom_name:delivery_roulier.product_small | ||
#: model:product.template,volume_uom_name:delivery_roulier.product_big_product_template | ||
#: model:product.template,volume_uom_name:delivery_roulier.product_small_product_template | ||
msgid "m³" | ||
msgstr "" |
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,4 @@ | ||
from . import stock_picking | ||
from . import stock_quant_package | ||
from . import stock_move_line | ||
from . import delivery_carrier |
Oops, something went wrong.