-
-
Notifications
You must be signed in to change notification settings - Fork 354
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 simahawk
- Loading branch information
Showing
25 changed files
with
1,924 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,151 @@ | ||
======================== | ||
Delivery Carrier Roulier | ||
======================== | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:f1b0fe3fd7a164fd66ce26ba17529c4b1124a199301d27f793e6c756f5a5ec61 | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |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/17.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-17-0/delivery-carrier-17-0-delivery_roulier | ||
: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=17.0 | ||
:alt: Try me on Runboat | ||
|
||
|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: | ||
|
||
Configuration | ||
============= | ||
|
||
This module needs package in order to work. To generate the carrier | ||
labels on the picking, each products need to be assigned to a | ||
destination package. In case you don't want to bother with the use of | ||
package because the whole content of the picking usually fit in a unique | ||
package, you may consider installing the module | ||
delivery_automatic_package from the same repository (delivery-carrier). | ||
The package will be assigned automatically when asking the carrier | ||
labels. | ||
|
||
Usage | ||
===== | ||
|
||
Here is some methods you can use for your carrier implementation | ||
allowing to have a consistent code accross different carrier modules: | ||
|
||
.. code:: 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:: 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 to smash it by providing a detailed and welcomed | ||
`feedback <https://github.com/OCA/delivery-carrier/issues/new?body=module:%20delivery_roulier%0Aversion:%2017.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 <sebastien.beau@akretion.com> | ||
- David Béal <david.beal@akretion.com> | ||
|
||
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/17.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 <raphael.reverdy@akretion.com> | ||
# David BEAL <david.beal@akretion.com> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
{ | ||
"name": "Delivery Carrier Roulier", | ||
"version": "17.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 <raphael.reverdy@akretion.com> | ||
# 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 = f"_{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,99 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * delivery_roulier | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 17.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 | ||
#. odoo-python | ||
#: 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 | ||
#. odoo-python | ||
#: 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 | ||
#. odoo-python | ||
#: 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 | ||
#. odoo-python | ||
#: code:addons/delivery_roulier/models/stock_quant_package.py:0 | ||
#, python-format | ||
msgid "" | ||
"Roulier library Exception for '%(carrier)s' carrier:\n" | ||
"\n" | ||
"%(exception)s\n" | ||
"\n" | ||
"Sent data:\n" | ||
"%(payload)s" | ||
msgstr "" | ||
|
||
#. module: delivery_roulier | ||
#: model:ir.model,name:delivery_roulier.model_delivery_carrier | ||
msgid "Shipping Methods" | ||
msgstr "" | ||
|
||
#. module: delivery_roulier | ||
#. odoo-python | ||
#: code:addons/delivery_roulier/models/stock_picking.py:0 | ||
#, python-format | ||
msgid "" | ||
"Some products have no destination package in picking %s, please add a " | ||
"destination package in order to be able to generate the carrier label." | ||
msgstr "" | ||
|
||
#. module: delivery_roulier | ||
#. odoo-python | ||
#: code:addons/delivery_roulier/models/stock_quant_package.py:0 | ||
#, python-format | ||
msgid "The tracking url is not available." | ||
msgstr "" | ||
|
||
#. module: delivery_roulier | ||
#: model:ir.model,name:delivery_roulier.model_stock_picking | ||
msgid "Transfer" | ||
msgstr "" | ||
|
||
#. module: delivery_roulier | ||
#: model:product.template,name:delivery_roulier.product_small_product_template | ||
msgid "carrier 1.3 kg" | ||
msgstr "" | ||
|
||
#. module: delivery_roulier | ||
#: model:product.template,name:delivery_roulier.product_big_product_template | ||
msgid "carrier 3.7 kg" | ||
msgstr "" |
Oops, something went wrong.