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

[16][MIG] delivery_roulier_dpd_fr #897

Open
wants to merge 10 commits into
base: 16.0
Choose a base branch
from
Open
95 changes: 95 additions & 0 deletions delivery_roulier_dpd_fr/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
=======================
Delivery Carrier DPD FR
=======================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:a52566f87c06596b2876559ef6c21813d482cdc5180b37512ba8da8f2f6a3d31
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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_roulier_dpd_fr
: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_roulier_dpd_fr
: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|

Send and track parcels with DPD France.

Products available: 'Classic', 'Predict', and 'Relais'. (previously known as Ici Relais and Exapaq).

**Table of contents**

.. contents::
:local:

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

* company form (Settings > Companies > Companies): complete address of the company, including phone number

* configuration the DPD account informations (Inventory > COnfiguration > Delivery > Carrier Account)

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_dpd_fr%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

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

* Raphaël REVERDY <[email protected]>
* Florian DA COSTA <[email protected]>
* Eric Bouhana <[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/16.0/delivery_roulier_dpd_fr>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions delivery_roulier_dpd_fr/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
29 changes: 29 additions & 0 deletions delivery_roulier_dpd_fr/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
"name": "Delivery Carrier DPD FR",
"version": "16.0.1.0.0",
"author": "Akretion, Odoo Community Association (OCA)",
"summary": "Generate Labels for DPD",
"category": "Warehouse",
"maintainers": ["florian-dacosta"],
"depends": [
"delivery_roulier",
],
"website": "https://github.com/OCA/delivery-carrier",
"data": [
"views/carrier_account_views.xml",
"data/product.product.xml",
"data/delivery_carrier.xml",
],
"demo": [
"demo/carrier_account.xml",
],
"external_dependencies": {
"python": [
"cerberus",
],
},
"installable": True,
"license": "AGPL-3",
}
25 changes: 25 additions & 0 deletions delivery_roulier_dpd_fr/data/delivery_carrier.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">

<record id="delivery_carrier_dpd_classic" model="delivery.carrier">
<field name="name">DPD Classic max 30kg</field>
<field name="delivery_type">dpd_fr_soap</field>
<field name="code">DPD_Classic</field>
<field name="product_id" ref="dpd_product" />
</record>

<record id="delivery_carrier_dpd_Relais" model="delivery.carrier">
<field name="name">DPD Relais max 20kg</field>
<field name="product_id" ref="dpd_product" />
<field name="code">DPD_Relais</field>
<field name="delivery_type">dpd_fr_soap</field>
</record>

<record id="delivery_carrier_dpd_Predict" model="delivery.carrier">
<field name="name">DPD Predict max 20kg</field>
<field name="product_id" ref="dpd_product" />
<field name="code">DPD_Predict</field>
<field name="delivery_type">dpd_fr_soap</field>
</record>

</odoo>
10 changes: 10 additions & 0 deletions delivery_roulier_dpd_fr/data/product.product.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">

<record id="dpd_product" model="product.product">
<field name="default_code">SHIP_DPD</field>
<field name="type">service</field>
<field name="name">Coûts de livraison - DPD</field>
</record>

</odoo>
10 changes: 10 additions & 0 deletions delivery_roulier_dpd_fr/demo/carrier_account.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">

<record id="demo_carrier_account_dpd" model="carrier.account">
<field name="name">Dpd default</field>
<field name="account">Demo Account</field>
<field name="password">Demo password</field>
<field name="delivery_type">dpd_fr_soap</field>
</record>
</odoo>
4 changes: 4 additions & 0 deletions delivery_roulier_dpd_fr/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from . import stock_picking
from . import delivery_carrier
from . import stock_quant_package
from . import carrier_account
15 changes: 15 additions & 0 deletions delivery_roulier_dpd_fr/models/carrier_account.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).


from odoo import fields, models


class CarrierAccount(models.Model):
_inherit = "carrier.account"

dpd_fr_soap_customer_country = fields.Char()
dpd_fr_soap_customer_id = fields.Char(string="DPD Customer ID")
dpd_fr_soap_agency_id = fields.Char(string="DPD Agency ID")
dpd_fr_soap_file_format = fields.Selection(
[("ZPL", "ZPL"), ("PDF", "PDF")], string="DPD file format"
)
12 changes: 12 additions & 0 deletions delivery_roulier_dpd_fr/models/delivery_carrier.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import fields, models


class DeliveryCarrier(models.Model):
_inherit = "delivery.carrier"

delivery_type = fields.Selection(
selection_add=[("dpd_fr_soap", "DPD")],
ondelete={"dpd_fr_soap": "set default"},
)
28 changes: 28 additions & 0 deletions delivery_roulier_dpd_fr/models/stock_picking.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import models


class StockPicking(models.Model):
_inherit = "stock.picking"

def _dpd_fr_soap_get_service(self, account, package=None):
service = self._roulier_get_service(account, package=package)
service.update(

Check warning on line 11 in delivery_roulier_dpd_fr/models/stock_picking.py

View check run for this annotation

Codecov / codecov/patch

delivery_roulier_dpd_fr/models/stock_picking.py#L10-L11

Added lines #L10 - L11 were not covered by tests
{
"customerCountry": account.dpd_fr_soap_customer_country,
"customerId": account.dpd_fr_soap_customer_id,
"agencyId": account.dpd_fr_soap_agency_id,
"reference1": self.sale_id.name or self.origin or self.name,
}
)
if self.carrier_code == "DPD_Relais":
service["pickupLocationId"] = self._dpd_dropoff_site()
service["notifications"] = "AutomaticSMS"

Check warning on line 21 in delivery_roulier_dpd_fr/models/stock_picking.py

View check run for this annotation

Codecov / codecov/patch

delivery_roulier_dpd_fr/models/stock_picking.py#L20-L21

Added lines #L20 - L21 were not covered by tests
if self.carrier_code == "DPD_Predict":
service["notifications"] = "Predict"
return service

Check warning on line 24 in delivery_roulier_dpd_fr/models/stock_picking.py

View check run for this annotation

Codecov / codecov/patch

delivery_roulier_dpd_fr/models/stock_picking.py#L23-L24

Added lines #L23 - L24 were not covered by tests

def _dpd_dropoff_site(self):
self.ensure_one()
return "" # like P22895 TODO implement this

Check warning on line 28 in delivery_roulier_dpd_fr/models/stock_picking.py

View check run for this annotation

Codecov / codecov/patch

delivery_roulier_dpd_fr/models/stock_picking.py#L27-L28

Added lines #L27 - L28 were not covered by tests
10 changes: 10 additions & 0 deletions delivery_roulier_dpd_fr/models/stock_quant_package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import models


class StockQuantPackage(models.Model):
_inherit = "stock.quant.package"

def _dpd_fr_soap_get_tracking_link(self):
return "http://www.dpd.fr/traces_%s" % self.parcel_tracking

Check warning on line 10 in delivery_roulier_dpd_fr/models/stock_quant_package.py

View check run for this annotation

Codecov / codecov/patch

delivery_roulier_dpd_fr/models/stock_quant_package.py#L10

Added line #L10 was not covered by tests
3 changes: 3 additions & 0 deletions delivery_roulier_dpd_fr/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* company form (Settings > Companies > Companies): complete address of the company, including phone number

* configuration the DPD account informations (Inventory > COnfiguration > Delivery > Carrier Account)
3 changes: 3 additions & 0 deletions delivery_roulier_dpd_fr/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* Raphaël REVERDY <[email protected]>
* Florian DA COSTA <[email protected]>
* Eric Bouhana <[email protected]>
3 changes: 3 additions & 0 deletions delivery_roulier_dpd_fr/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Send and track parcels with DPD France.

Products available: 'Classic', 'Predict', and 'Relais'. (previously known as Ici Relais and Exapaq).
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading