Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[17.0][MIG] delivery_roulier: Migration to 17.0 #826

Merged
merged 101 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
a4898a0
Add delivery_roulier
Dec 2, 2016
120b3b4
Clean roulier demo
Dec 12, 2016
233822e
Move account selection in roulier
Dec 12, 2016
264a5c1
IMP put cn23 in attachment
bealdav Dec 2, 2016
911a41c
Add suspend_security
Dec 13, 2016
87e69ff
flake8
Dec 14, 2016
3398e7a
Remove trailing whitespace
Dec 14, 2016
21885fa
Update docstrings
hparfr Jan 4, 2017
0c7286b
Fix nonbreakable space in phones
hparfr Jan 5, 2017
cfd7b4e
Warning if no instrastat module
hparfr Jan 9, 2017
3503fbc
Small refactoring
hparfr Jan 9, 2017
9d24062
Fix tels
hparfr Jan 12, 2017
161a6d9
Fix base64 carriage return errors
hparfr Jan 16, 2017
a440b4b
Set number_of_packages
hparfr Jan 18, 2017
ab7470b
Add back intrastat
hparfr Feb 2, 2017
269a8eb
Refactore error handling (#76)
hparfr Feb 27, 2017
0db3181
Better attachement handling (#77)
hparfr Feb 27, 2017
2e6abea
Implement open_website_url (#78)
hparfr Mar 3, 2017
53dfcf2
Rename files
hparfr Mar 16, 2017
f112c3f
Remove dummy carrier
hparfr Mar 16, 2017
c68d6e3
Fix return attachments
hparfr Mar 22, 2017
b086191
Add package name in attachemnts
hparfr Mar 31, 2017
4efced9
Add pack name in datas_fname (file name)
hparfr Mar 31, 2017
c24b10f
Remove laposte demo
hparfr Apr 5, 2017
dd5c617
Update readme
hparfr Apr 5, 2017
8cddd43
Add main dep
hparfr Apr 7, 2017
2d90730
Fix bad input
hparfr Apr 10, 2017
0f5818f
Move options to a dedicated module
hparfr Apr 10, 2017
162fa70
Fix pylin
hparfr Apr 10, 2017
e63b4bf
Pylint stuff
hparfr Apr 10, 2017
724e686
Fix new api with parcels instead of parcel
hparfr May 16, 2017
39b641f
Incr lib version
hparfr May 17, 2017
34facdd
api.multi for parcels
hparfr May 18, 2017
f42c672
Move shipping id generation to picking
hparfr May 22, 2017
d90475f
Fix decorator
hparfr May 22, 2017
10dd26a
Remove pdb and improve edi
hparfr May 23, 2017
9a67ce8
Fix get_carrier_type
hparfr May 30, 2017
149ce88
Add logging when exceptions, add incoterms and codesa
hparfr Jul 7, 2017
f61fa62
Fix variable name
florian-dacosta Nov 30, 2017
ad1f9f7
Fill carrier_id on package when creating labels
florian-dacosta Nov 30, 2017
7dd766b
Port laposte to 10
hparfr Dec 13, 2017
03440d9
update get_password to new api
hparfr Feb 6, 2018
1bc0099
Avoid crash when HS code is missing
alexis-via Apr 20, 2018
8b595f0
delivery_roulier: accurate computation of unit price for CN23
alexis-via Apr 20, 2018
025e5fb
Rename method
alexis-via May 30, 2018
457dbe6
Adapt to changes in product_harmonized_system
alexis-via Oct 30, 2018
40f1bd1
[FIX] use shipping weight if defined (more accurate)
Nov 6, 2018
b52ba48
MIGR v12 delivery_roulier
bealdav Aug 28, 2019
ac88cbf
fixup!
bealdav Aug 29, 2019
2de0723
[REF] Continue migration and some refactores
florian-dacosta Sep 5, 2019
af6570a
Make roulier compatible with native odoo carrier process
florian-dacosta Sep 10, 2019
39c3fdc
fixup! [REF] Continue migration and some refactores
florian-dacosta Sep 11, 2019
824324c
IMP delivery_roulier: add demo data
bealdav Sep 13, 2019
a52c040
Add extension to file name
florian-dacosta Oct 22, 2019
f7b5485
Adapt to roulier refactore + manage multiple label
florian-dacosta May 29, 2020
d13386c
Clean some code after hbrunn review
florian-dacosta Sep 3, 2020
f364e7b
Avoid calling send_shipping super in case of roulier
florian-dacosta Oct 26, 2020
062813a
Fix method name
florian-dacosta Oct 30, 2020
9967447
Add basic test to delivery_roulier
florian-dacosta Nov 12, 2020
1d8ea47
[IMP] delivery_roulier: black, isort, prettier
florian-dacosta Dec 8, 2020
cc81f95
[MIG] delivery_roulier: Migration to 14.0
florian-dacosta Dec 8, 2020
41fac33
Find the right label shipping package even in case of multiple packags
florian-dacosta Dec 8, 2020
c6facd1
Fix get tracking link
florian-dacosta Dec 8, 2020
37fbc44
Fix shipping date format according to roulier update
florian-dacosta Feb 11, 2021
9c3512e
Adapt to base_delivery_carrier_label refactore
florian-dacosta Mar 9, 2021
8d717e6
Fix code linting and test dependencies
florian-dacosta May 26, 2021
e079325
Avoid logging or displaying carrier account password if an error occurs
florian-dacosta Jun 2, 2021
877cc94
[FIX] Avoid trying to print label with roulier if delivery type is no…
florian-dacosta Jun 2, 2021
2ffe3f2
[REF] Use method defined in base_delivery_carrier_label to avoid code…
florian-dacosta Jun 7, 2021
5f8ebf0
[UPD] Update delivery_roulier.pot
oca-travis Jul 3, 2021
f57cfaa
[UPD] README.rst
OCA-git-bot Jul 4, 2021
5bb50d4
[ADD] icon.png
OCA-git-bot Jul 4, 2021
f755bba
Revert roulier magic mock once tests are done in delivery_roulier bec…
florian-dacosta Jul 13, 2021
e46c555
[FIX] delivery_roulier: Fix access right issues when using actions
sebalix Jan 31, 2022
953b50a
delivery_roulier 14.0.1.0.1
OCA-git-bot Feb 2, 2022
52f9dd2
[IMP] update dotfiles [ci skip]
OCA-git-bot Mar 30, 2022
a921de0
[UPD] Update delivery_roulier.pot
Nov 3, 2022
accfd23
Avoid failure if getting price from carrier webservice is not impleme…
florian-dacosta Aug 25, 2021
db7ec8b
[IMP] Improve default address sent to roulier
florian-dacosta Jan 7, 2022
8337f31
Improve price_unit we send for customs documents to manage phantom bo…
florian-dacosta Nov 18, 2022
6c65f22
[MIG] Migrate delivery_roulier to v16
florian-dacosta Nov 24, 2022
7437712
[FIX] Remove carrier account view override since unwanted field has b…
florian-dacosta Dec 11, 2022
b0ae6c8
[FIX] price taken on product for customs document should be total pri…
florian-dacosta Dec 21, 2022
c166a7a
Remove duplicated view from base_delivery_carrier_label
florian-dacosta Jan 25, 2023
63dc966
Fix delivery get tracking link to match manage multiple pickings as n…
florian-dacosta Feb 24, 2023
a513e5a
[IMP] Avoid duplicates tracking number in picking + display clean err…
florian-dacosta May 24, 2023
6454469
[IMP] delivery_roulier : raise if product with no package since it n…
florian-dacosta May 31, 2023
3efa65d
[FIX] delivery_roulier fix tests
florian-dacosta May 31, 2023
9674257
[IMP] delivery_roulier : allow to easily by pass the tracking url per…
florian-dacosta Jun 8, 2023
e107b6d
[IMP] delivery_roulier : manage package tracking uri
florian-dacosta Jun 8, 2023
51685b0
[FIX] remove comment and improve readme to talk about the delivery_au…
florian-dacosta Jun 14, 2023
47b1930
[FIX] Disable unwanted pylint warning
florian-dacosta Oct 4, 2023
663a721
[UPD] Update delivery_roulier.pot
Oct 5, 2023
e43ba84
[BOT] post-merge updates
OCA-git-bot Oct 5, 2023
7fc96aa
Added translation using Weblate (Spanish)
Ivorra78 Oct 9, 2023
7915554
Translated using Weblate (Spanish)
Ivorra78 Oct 9, 2023
828a454
Added translation using Weblate (Italian)
mymage May 6, 2024
c0bb4cd
Translated using Weblate (Italian)
mymage May 7, 2024
4d2effc
[IMP] delivery_roulier: pre-commit auto fixes
yankinmax Jun 28, 2024
881d2ab
[MIG] delivery_roulier: Migration to 17.0
yankinmax Jun 28, 2024
9b07dd9
[FIX] delivery_roulier : get_tracking_link should return an url inste…
florian-dacosta Jul 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
151 changes: 151 additions & 0 deletions delivery_roulier/README.rst
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.
3 changes: 3 additions & 0 deletions delivery_roulier/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import models

from .decorator import implemented_by_carrier
27 changes: 27 additions & 0 deletions delivery_roulier/__manifest__.py
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",
}
42 changes: 42 additions & 0 deletions delivery_roulier/decorator.py
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

Check warning on line 34 in delivery_roulier/decorator.py

View check run for this annotation

Codecov / codecov/patch

delivery_roulier/decorator.py#L34

Added line #L34 was not covered by tests

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
16 changes: 16 additions & 0 deletions delivery_roulier/demo/product.xml
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>
99 changes: 99 additions & 0 deletions delivery_roulier/i18n/delivery_roulier.pot
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 ""
Loading
Loading