Skip to content

Commit 14f5747

Browse files
committed
Merge PR OCA#4900 into 18.0
Signed-off-by pedrobaeza
2 parents 7867e40 + cac2dbf commit 14f5747

4 files changed

Lines changed: 46 additions & 39 deletions

File tree

delivery_gls_asm/README.rst

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
.. image:: https://odoo-community.org/readme-banner-image
2-
:target: https://odoo-community.org/get-involved?utm_source=readme
3-
:alt: Odoo Community Association
4-
51
================
62
Delivery GLS-ASM
73
================
@@ -17,7 +13,7 @@ Delivery GLS-ASM
1713
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
1814
:target: https://odoo-community.org/page/development-status
1915
:alt: Beta
20-
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
2117
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
2218
:alt: License: AGPL-3
2319
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--spain-lightgray.png?logo=github
@@ -190,6 +186,7 @@ Contributors
190186

191187
- David Vidal
192188
- Víctor Martínez
189+
- Sergio Teruel
193190

194191
- `Studio73 <https://www.studio73.es>`__:
195192

delivery_gls_asm/models/delivery_carrier.py

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ def _prepare_gls_asm_shipping(self, picking):
154154
"remite_provincia": escape(sender_partner.state_id.name or ""),
155155
"remite_pais": "34", # [mandatory] always 34=Spain
156156
"remite_cp": sender_partner.zip or "",
157-
"remite_telefono": sender_partner.phone or "",
158-
"remite_movil": sender_partner.mobile or "",
157+
"remite_telefono": self._sanitize_phone_gls(sender_partner.phone or ""),
158+
"remite_movil": self._sanitize_phone_gls(sender_partner.mobile or ""),
159159
"remite_email": escape(sender_partner.email or ""),
160160
"remite_departamento": "",
161161
"remite_nif": sender_partner.vat or "",
@@ -172,8 +172,12 @@ def _prepare_gls_asm_shipping(self, picking):
172172
"destinatario_cp": consignee.zip,
173173
# For certain destinations the consignee mobile and email are required to
174174
# make the expedition. Try to fallback to the commercial entity one
175-
"destinatario_telefono": consignee.phone or consignee_entity.phone or "",
176-
"destinatario_movil": consignee.mobile or consignee_entity.mobile or "",
175+
"destinatario_telefono": self._sanitize_phone_gls(
176+
consignee.phone or consignee_entity.phone or ""
177+
),
178+
"destinatario_movil": self._sanitize_phone_gls(
179+
consignee.mobile or consignee_entity.mobile or ""
180+
),
177181
"destinatario_email": escape(
178182
consignee.email or consignee_entity.email or ""
179183
),
@@ -231,10 +235,10 @@ def _prepare_gls_asm_pickup(self, picking):
231235
"remite_provincia": sender_partner.state_id.name or "",
232236
"remite_pais": (sender_partner.country_id.phone_code or ""),
233237
"remite_cp": sender_partner.zip or "",
234-
"remite_telefono": (
238+
"remite_telefono": self._sanitize_phone_gls(
235239
sender_partner.phone or sender_partner.parent_id.phone or ""
236240
),
237-
"remite_movil": (
241+
"remite_movil": self._sanitize_phone_gls(
238242
sender_partner.mobile or sender_partner.parent_id.mobile or ""
239243
),
240244
"remite_email": (
@@ -248,10 +252,10 @@ def _prepare_gls_asm_pickup(self, picking):
248252
"destinatario_provincia": receiving_partner.state_id.name or "",
249253
"destinatario_pais": (receiving_partner.country_id.code or ""),
250254
"destinatario_cp": receiving_partner.zip or "",
251-
"destinatario_telefono": (
255+
"destinatario_telefono": self._sanitize_phone_gls(
252256
receiving_partner.phone or receiving_partner.parent_id.phone or ""
253257
),
254-
"destinatario_movil": (
258+
"destinatario_movil": self._sanitize_phone_gls(
255259
receiving_partner.mobile or receiving_partner.parent_id.mobile or ""
256260
),
257261
"destinatario_email": (
@@ -533,3 +537,13 @@ def action_get_manifest(self):
533537
"res_id": wizard.id,
534538
"context": self.env.context,
535539
}
540+
541+
@api.model
542+
def _sanitize_phone_gls(self, phone_number):
543+
"""Use method from phone_validation module without add it to dependencies
544+
Default format is E164
545+
"""
546+
sanitize = getattr(self, "_phone_format", None)
547+
if sanitize:
548+
phone_number = sanitize(number=phone_number)
549+
return phone_number
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
- [Tecnativa](https://www.tecnativa.com):
22
- David Vidal
33
- Víctor Martínez
4+
- Sergio Teruel
45
- [Studio73](https://www.studio73.es):
56
- Ethan Hildick
67
- David López

delivery_gls_asm/static/description/index.html

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
55
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
6-
<title>README.rst</title>
6+
<title>Delivery GLS-ASM</title>
77
<style type="text/css">
88

99
/*
@@ -360,21 +360,16 @@
360360
</style>
361361
</head>
362362
<body>
363-
<div class="document">
363+
<div class="document" id="delivery-gls-asm">
364+
<h1 class="title">Delivery GLS-ASM</h1>
364365

365-
366-
<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
367-
<img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
368-
</a>
369-
<div class="section" id="delivery-gls-asm">
370-
<h1>Delivery GLS-ASM</h1>
371366
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
372367
!! This file is generated by oca-gen-addon-readme !!
373368
!! changes will be overwritten. !!
374369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
375370
!! source digest: sha256:d06e60c25de1f81ca2dae99923ac9b0aa5483d0c0f75b199c6b68b616c5b51cb
376371
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
377-
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/l10n-spain/tree/18.0/delivery_gls_asm"><img alt="OCA/l10n-spain" src="https://img.shields.io/badge/github-OCA%2Fl10n--spain-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/l10n-spain-18-0/l10n-spain-18-0-delivery_gls_asm"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/l10n-spain&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
372+
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/l10n-spain/tree/18.0/delivery_gls_asm"><img alt="OCA/l10n-spain" src="https://img.shields.io/badge/github-OCA%2Fl10n--spain-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/l10n-spain-18-0/l10n-spain-18-0-delivery_gls_asm"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/l10n-spain&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
378373
<p>Este módulo integra la API de GLS España (antigua API de ASM) con Odoo.
379374
No es válido para integraciones de GLS en otros países, que podrían usar
380375
otras APIs.</p>
@@ -404,7 +399,7 @@ <h1>Delivery GLS-ASM</h1>
404399
</ul>
405400
</div>
406401
<div class="section" id="installation">
407-
<h2><a class="toc-backref" href="#toc-entry-1">Installation</a></h2>
402+
<h1><a class="toc-backref" href="#toc-entry-1">Installation</a></h1>
408403
<p>Este módulo necesita la librería python suds-py3 y depende igualmente de
409404
los módulos de OCA/delivery-carrier delivery_package_number y
410405
delivery_state.</p>
@@ -413,7 +408,7 @@ <h2><a class="toc-backref" href="#toc-entry-1">Installation</a></h2>
413408
módulo delivery_price_method.</p>
414409
</div>
415410
<div class="section" id="configuration">
416-
<h2><a class="toc-backref" href="#toc-entry-2">Configuration</a></h2>
411+
<h1><a class="toc-backref" href="#toc-entry-2">Configuration</a></h1>
417412
<p>Para configurar el transportista:</p>
418413
<ol class="arabic simple">
419414
<li>Vaya a <em>Inventario &gt; Configuración &gt; Entrega &gt; Método de envío</em> y
@@ -429,10 +424,10 @@ <h2><a class="toc-backref" href="#toc-entry-2">Configuration</a></h2>
429424
los <em>Parámetros del sistema</em> en la clave delivery_gls_asm.api_user_demo.</p>
430425
</div>
431426
<div class="section" id="usage">
432-
<h2><a class="toc-backref" href="#toc-entry-3">Usage</a></h2>
427+
<h1><a class="toc-backref" href="#toc-entry-3">Usage</a></h1>
433428
<p>Estas son las distintas operaciones posibles con este módulo:</p>
434429
<div class="section" id="grabar-servicios">
435-
<h3><a class="toc-backref" href="#toc-entry-4">Grabar servicios</a></h3>
430+
<h2><a class="toc-backref" href="#toc-entry-4">Grabar servicios</a></h2>
436431
<blockquote>
437432
<ol class="arabic simple">
438433
<li>Al confirmar el albarán, el servicio se grabará en GLS.</li>
@@ -448,7 +443,7 @@ <h3><a class="toc-backref" href="#toc-entry-4">Grabar servicios</a></h3>
448443
</blockquote>
449444
</div>
450445
<div class="section" id="pedir-recogidas">
451-
<h3><a class="toc-backref" href="#toc-entry-5">Pedir recogidas</a></h3>
446+
<h2><a class="toc-backref" href="#toc-entry-5">Pedir recogidas</a></h2>
452447
<blockquote>
453448
<ol class="arabic simple">
454449
<li>Al confirmar el albarán con un servicio de recogida, el envío NO
@@ -465,7 +460,7 @@ <h3><a class="toc-backref" href="#toc-entry-5">Pedir recogidas</a></h3>
465460
</blockquote>
466461
</div>
467462
<div class="section" id="cancelar-servicios">
468-
<h3><a class="toc-backref" href="#toc-entry-6">Cancelar servicios</a></h3>
463+
<h2><a class="toc-backref" href="#toc-entry-6">Cancelar servicios</a></h2>
469464
<blockquote>
470465
<ol class="arabic simple">
471466
<li>Al igual que en otros métodos de envío, en los albaranes de salida
@@ -479,7 +474,7 @@ <h3><a class="toc-backref" href="#toc-entry-6">Cancelar servicios</a></h3>
479474
</blockquote>
480475
</div>
481476
<div class="section" id="obtener-etiquetas">
482-
<h3><a class="toc-backref" href="#toc-entry-7">Obtener etiquetas</a></h3>
477+
<h2><a class="toc-backref" href="#toc-entry-7">Obtener etiquetas</a></h2>
483478
<blockquote>
484479
<ol class="arabic simple">
485480
<li>Si por error hubiésemos eliminado el adjunto de las etiquetas que
@@ -490,7 +485,7 @@ <h3><a class="toc-backref" href="#toc-entry-7">Obtener etiquetas</a></h3>
490485
</blockquote>
491486
</div>
492487
<div class="section" id="seguimiento-de-envios">
493-
<h3><a class="toc-backref" href="#toc-entry-8">Seguimiento de envíos</a></h3>
488+
<h2><a class="toc-backref" href="#toc-entry-8">Seguimiento de envíos</a></h2>
494489
<blockquote>
495490
<ol class="arabic simple">
496491
<li>El módulo está integrado con delivery_state para poder recabar la
@@ -504,7 +499,7 @@ <h3><a class="toc-backref" href="#toc-entry-8">Seguimiento de envíos</a></h3>
504499
</blockquote>
505500
</div>
506501
<div class="section" id="manifiesto-de-envios">
507-
<h3><a class="toc-backref" href="#toc-entry-9">Manifiesto de envíos</a></h3>
502+
<h2><a class="toc-backref" href="#toc-entry-9">Manifiesto de envíos</a></h2>
508503
<blockquote>
509504
<ol class="arabic simple">
510505
<li>Para obtener el manifiesto de expediciones que firmaría el
@@ -520,7 +515,7 @@ <h3><a class="toc-backref" href="#toc-entry-9">Manifiesto de envíos</a></h3>
520515
</blockquote>
521516
</div>
522517
<div class="section" id="depuracion-de-errores">
523-
<h3><a class="toc-backref" href="#toc-entry-10">Depuración de errores</a></h3>
518+
<h2><a class="toc-backref" href="#toc-entry-10">Depuración de errores</a></h2>
524519
<blockquote>
525520
<ol class="arabic simple">
526521
<li>Es importante tener en cuenta que solo funcionará con códigos
@@ -536,7 +531,7 @@ <h3><a class="toc-backref" href="#toc-entry-10">Depuración de errores</a></h3>
536531
</div>
537532
</div>
538533
<div class="section" id="known-issues-roadmap">
539-
<h2><a class="toc-backref" href="#toc-entry-11">Known issues / Roadmap</a></h2>
534+
<h1><a class="toc-backref" href="#toc-entry-11">Known issues / Roadmap</a></h1>
540535
<ul class="simple">
541536
<li>La API no facilita métodos para cotizar el coste real de los envíos,
542537
por lo que siempre se cotizan a 0. Si la cotización de envíos es
@@ -545,27 +540,28 @@ <h2><a class="toc-backref" href="#toc-entry-11">Known issues / Roadmap</a></h2>
545540
</ul>
546541
</div>
547542
<div class="section" id="bug-tracker">
548-
<h2><a class="toc-backref" href="#toc-entry-12">Bug Tracker</a></h2>
543+
<h1><a class="toc-backref" href="#toc-entry-12">Bug Tracker</a></h1>
549544
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/l10n-spain/issues">GitHub Issues</a>.
550545
In case of trouble, please check there if your issue has already been reported.
551546
If you spotted it first, help us to smash it by providing a detailed and welcomed
552547
<a class="reference external" href="https://github.com/OCA/l10n-spain/issues/new?body=module:%20delivery_gls_asm%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
553548
<p>Do not contact contributors directly about support or help with technical issues.</p>
554549
</div>
555550
<div class="section" id="credits">
556-
<h2><a class="toc-backref" href="#toc-entry-13">Credits</a></h2>
551+
<h1><a class="toc-backref" href="#toc-entry-13">Credits</a></h1>
557552
<div class="section" id="authors">
558-
<h3><a class="toc-backref" href="#toc-entry-14">Authors</a></h3>
553+
<h2><a class="toc-backref" href="#toc-entry-14">Authors</a></h2>
559554
<ul class="simple">
560555
<li>Tecnativa</li>
561556
</ul>
562557
</div>
563558
<div class="section" id="contributors">
564-
<h3><a class="toc-backref" href="#toc-entry-15">Contributors</a></h3>
559+
<h2><a class="toc-backref" href="#toc-entry-15">Contributors</a></h2>
565560
<ul class="simple">
566561
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
567562
<li>David Vidal</li>
568563
<li>Víctor Martínez</li>
564+
<li>Sergio Teruel</li>
569565
</ul>
570566
</li>
571567
<li><a class="reference external" href="https://www.studio73.es">Studio73</a>:<ul>
@@ -576,7 +572,7 @@ <h3><a class="toc-backref" href="#toc-entry-15">Contributors</a></h3>
576572
</ul>
577573
</div>
578574
<div class="section" id="maintainers">
579-
<h3><a class="toc-backref" href="#toc-entry-16">Maintainers</a></h3>
575+
<h2><a class="toc-backref" href="#toc-entry-16">Maintainers</a></h2>
580576
<p>This module is maintained by the OCA.</p>
581577
<a class="reference external image-reference" href="https://odoo-community.org">
582578
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
@@ -591,6 +587,5 @@ <h3><a class="toc-backref" href="#toc-entry-16">Maintainers</a></h3>
591587
</div>
592588
</div>
593589
</div>
594-
</div>
595590
</body>
596591
</html>

0 commit comments

Comments
 (0)