Skip to content

Commit c791c36

Browse files
committed
[IMP] delivery_ups_oca: pre-commit auto fixes
1 parent d85ef02 commit c791c36

14 files changed

+156
-137
lines changed

delivery_ups_oca/README.rst

+53-47
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,27 @@ Delivery UPS OCA
1717
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
1818
:alt: License: AGPL-3
1919
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fdelivery--carrier-lightgray.png?logo=github
20-
:target: https://github.com/OCA/delivery-carrier/tree/14.0/delivery_ups_oca
20+
:target: https://github.com/OCA/delivery-carrier/tree/17.0/delivery_ups_oca
2121
:alt: OCA/delivery-carrier
2222
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23-
:target: https://translation.odoo-community.org/projects/delivery-carrier-14-0/delivery-carrier-14-0-delivery_ups_oca
23+
:target: https://translation.odoo-community.org/projects/delivery-carrier-17-0/delivery-carrier-17-0-delivery_ups_oca
2424
:alt: Translate me on Weblate
2525
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26-
:target: https://runboat.odoo-community.org/builds?repo=OCA/delivery-carrier&target_branch=14.0
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/delivery-carrier&target_branch=17.0
2727
:alt: Try me on Runboat
2828

2929
|badge1| |badge2| |badge3| |badge4| |badge5|
3030

31-
This module adds `UPS <https://ups.com>`_ to the available carriers.
31+
This module adds `UPS <https://ups.com>`__ to the available carriers.
3232

33-
It allows you to register shippings, generate labels, get rates from order, read
34-
shipping states and cancel shipments using UPS webservice, so no need of exchanging
35-
any kind of file.
33+
It allows you to register shippings, generate labels, get rates from
34+
order, read shipping states and cancel shipments using UPS webservice,
35+
so no need of exchanging any kind of file.
3636

37-
When a sales order is created in Odoo and the UPS carrier is assigned, the shipping
38-
price that will be obtained will be the price that the UPS webservice estimates
39-
according to the order information (address and products).
37+
When a sales order is created in Odoo and the UPS carrier is assigned,
38+
the shipping price that will be obtained will be the price that the UPS
39+
webservice estimates according to the order information (address and
40+
products).
4041

4142
**Table of contents**
4243

@@ -48,79 +49,84 @@ Configuration
4849

4950
To configure this module, you need to:
5051

51-
#. Add a carrier account with delivery type ``ups`` and fill in your credentials (UPS
52-
Client and UPS Client Secret)
53-
#. Configure in Odoo all required fields of the UPS tab with your account data
54-
https://wwwapps.ups.com/ppc/ppc.html (Shipper number, Default Packaging, Package
55-
Dimension Code, Package Weight Code and File Format).
56-
#. If yo have "Tracking state update sync" checked all delivery orders state check will
57-
be done querying UPS services.
58-
#. It is possible to create a UPS carrier for cash on delivery parcels. Select the
59-
``ups`` delivery type and check the "Cash on Delivery" checkbox under the "UPS" tab.
60-
It is required to select the "UPS COD Funds Code" when the "Cash on Delivery" option
61-
is selected.
62-
63-
**NOTE** You need to add an APP from https://developer.ups.com/ for using the
64-
webservice.
52+
1. Add a carrier account with delivery type ``ups`` and fill in your
53+
credentials (UPS Client and UPS Client Secret)
54+
2. Configure in Odoo all required fields of the UPS tab with your
55+
account data https://wwwapps.ups.com/ppc/ppc.html (Shipper number,
56+
Default Packaging, Package Dimension Code, Package Weight Code and
57+
File Format).
58+
3. If yo have "Tracking state update sync" checked all delivery orders
59+
state check will be done querying UPS services.
60+
4. It is possible to create a UPS carrier for cash on delivery parcels.
61+
Select the ``ups`` delivery type and check the "Cash on Delivery"
62+
checkbox under the "UPS" tab. It is required to select the "UPS COD
63+
Funds Code" when the "Cash on Delivery" option is selected.
64+
65+
**NOTE** You need to add an APP from https://developer.ups.com/ for
66+
using the webservice.
6567

6668
Usage
6769
=====
6870

69-
You have to set the created shipping method in the delivery order to ship:
71+
You have to set the created shipping method in the delivery order to
72+
ship:
7073

71-
* When the picking is 'Transferred', a *Create Shipping Label* button appears. Just
72-
click on it, and if all went well, the label will be 'attached'.
73-
* If the shipment creation process fails, a validation error will appear displaying UPS
74-
error.
75-
* When the delivery order is cancelled, it's automatically cancelled too in UPS.
76-
* If you have "Tracking state update sync" checked in the shipping method, a periodical
77-
state check will be done querying UPS services.
74+
- When the picking is 'Transferred', a *Create Shipping Label* button
75+
appears. Just click on it, and if all went well, the label will be
76+
'attached'.
77+
- If the shipment creation process fails, a validation error will
78+
appear displaying UPS error.
79+
- When the delivery order is cancelled, it's automatically cancelled
80+
too in UPS.
81+
- If you have "Tracking state update sync" checked in the shipping
82+
method, a periodical state check will be done querying UPS services.
7883

7984
Known issues / Roadmap
8085
======================
8186

82-
* Support international forms
83-
* Support package service options
87+
- Support international forms
88+
- Support package service options
8489

8590
Bug Tracker
8691
===========
8792

8893
Bugs are tracked on `GitHub Issues <https://github.com/OCA/delivery-carrier/issues>`_.
8994
In case of trouble, please check there if your issue has already been reported.
9095
If you spotted it first, help us to smash it by providing a detailed and welcomed
91-
`feedback <https://github.com/OCA/delivery-carrier/issues/new?body=module:%20delivery_ups_oca%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
96+
`feedback <https://github.com/OCA/delivery-carrier/issues/new?body=module:%20delivery_ups_oca%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
9297

9398
Do not contact contributors directly about support or help with technical issues.
9499

95100
Credits
96101
=======
97102

98103
Authors
99-
~~~~~~~
104+
-------
100105

101106
* Hunki Enterprises BV
102107
* Tecnativa
103108
* ForgeFlow
104109

105110
Contributors
106-
~~~~~~~~~~~~
111+
------------
107112

108-
* Holger Brunn <mail@hunki-enterprises.nl> (https://hunki-enterprises.nl)
109-
* `Tecnativa <https://www.tecnativa.com>`_:
113+
- Holger Brunn <mail@hunki-enterprises.nl>
114+
(https://hunki-enterprises.nl)
115+
- `Tecnativa <https://www.tecnativa.com>`__:
110116

111-
* Víctor Martínez
112-
* Pedro M. Baeza
117+
- Víctor Martínez
118+
- Pedro M. Baeza
113119

114-
* `ForgeFlow <https://www.forgeflow.com>`_:
120+
- `ForgeFlow <https://www.forgeflow.com>`__:
115121

116-
* Jordi Ballester
122+
- Jordi Ballester
117123

118-
* `Sygel <https://www.sygel.es>`_:
124+
- `Sygel <https://www.sygel.es>`__:
119125

120-
* Manuel Regidor
126+
- Manuel Regidor
121127

122128
Maintainers
123-
~~~~~~~~~~~
129+
-----------
124130

125131
This module is maintained by the OCA.
126132

@@ -132,6 +138,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
132138
mission is to support the collaborative development of Odoo features and
133139
promote its widespread use.
134140

135-
This module is part of the `OCA/delivery-carrier <https://github.com/OCA/delivery-carrier/tree/14.0/delivery_ups_oca>`_ project on GitHub.
141+
This module is part of the `OCA/delivery-carrier <https://github.com/OCA/delivery-carrier/tree/17.0/delivery_ups_oca>`_ project on GitHub.
136142

137143
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

delivery_ups_oca/models/ups_request.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
_logger = logging.getLogger(__name__)
1515

1616

17-
class UpsRequest(object):
17+
class UpsRequest:
1818
def __init__(self, carrier):
1919
self.carrier = carrier
2020
self.default_packaging_id = self.carrier.ups_default_packaging_id
@@ -90,7 +90,7 @@ def _process_reply(
9090
self._get_new_token()
9191
data = data or {}
9292
headers = {
93-
"Authorization": "Bearer {}".format(self.token),
93+
"Authorization": f"Bearer {self.token}",
9494
}
9595
if headers_extra:
9696
headers = {**headers, **headers_extra}
@@ -100,7 +100,7 @@ def _process_reply(
100100
self._get_new_token()
101101
status = self._send_request(url, json, data, headers, method)
102102
status = status.json()
103-
ups_last_request = ("URL: {}\nData: {}").format(self.url, data)
103+
ups_last_request = f"URL: {self.url}\nData: {data}"
104104
self.carrier.log_xml(ups_last_request, "ups_last_request")
105105
self.carrier.log_xml(status or "", "ups_last_response")
106106
return status
@@ -349,7 +349,7 @@ def shipping_label(self, carrier_tracking_ref):
349349

350350
def cancel_shipment(self, picking):
351351
url = "%s/api/shipments/v1/void/cancel" % self.url
352-
url = "{}/{}".format(url, picking.carrier_tracking_ref)
352+
url = f"{url}/{picking.carrier_tracking_ref}"
353353
status = self._process_reply(url=url, method="delete")
354354
self._raise_for_status(status, False)
355355
return True
@@ -366,8 +366,8 @@ def tracking_state_update(self, picking):
366366
url="%s/api/track/v1/details/%s" % (self.url, picking.carrier_tracking_ref),
367367
method="get",
368368
headers_extra={
369-
"transId": "{}".format(datetime.datetime.now().timestamp()),
370-
"transactionSrc": "{} - Odoo".format(picking.company_id.name),
369+
"transId": f"{datetime.datetime.now().timestamp()}",
370+
"transactionSrc": f"{picking.company_id.name} - Odoo",
371371
},
372372
)
373373
self._raise_for_status(status, False)

delivery_ups_oca/pyproject.toml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["whool"]
3+
build-backend = "whool.buildapi"

delivery_ups_oca/readme/CONFIGURE.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
To configure this module, you need to:
2+
3+
1. Add a carrier account with delivery type `ups` and fill in your
4+
credentials (UPS Client and UPS Client Secret)
5+
2. Configure in Odoo all required fields of the UPS tab with your
6+
account data <https://wwwapps.ups.com/ppc/ppc.html> (Shipper number,
7+
Default Packaging, Package Dimension Code, Package Weight Code and
8+
File Format).
9+
3. If yo have "Tracking state update sync" checked all delivery orders
10+
state check will be done querying UPS services.
11+
4. It is possible to create a UPS carrier for cash on delivery parcels.
12+
Select the `ups` delivery type and check the "Cash on Delivery"
13+
checkbox under the "UPS" tab. It is required to select the "UPS COD
14+
Funds Code" when the "Cash on Delivery" option is selected.
15+
16+
**NOTE** You need to add an APP from <https://developer.ups.com/> for
17+
using the webservice.

delivery_ups_oca/readme/CONFIGURE.rst

-16
This file was deleted.
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
- Holger Brunn \<<mail@hunki-enterprises.nl>\>
2+
(<https://hunki-enterprises.nl>)
3+
- [Tecnativa](https://www.tecnativa.com):
4+
- Víctor Martínez
5+
- Pedro M. Baeza
6+
- [ForgeFlow](https://www.forgeflow.com):
7+
- Jordi Ballester
8+
- [Sygel](https://www.sygel.es):
9+
- Manuel Regidor

delivery_ups_oca/readme/CONTRIBUTORS.rst

-13
This file was deleted.
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
This module adds [UPS](https://ups.com) to the available carriers.
2+
3+
It allows you to register shippings, generate labels, get rates from
4+
order, read shipping states and cancel shipments using UPS webservice,
5+
so no need of exchanging any kind of file.
6+
7+
When a sales order is created in Odoo and the UPS carrier is assigned,
8+
the shipping price that will be obtained will be the price that the UPS
9+
webservice estimates according to the order information (address and
10+
products).

delivery_ups_oca/readme/DESCRIPTION.rst

-9
This file was deleted.

delivery_ups_oca/readme/ROADMAP.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- Support international forms
2+
- Support package service options

delivery_ups_oca/readme/ROADMAP.rst

-2
This file was deleted.

delivery_ups_oca/readme/USAGE.md

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
You have to set the created shipping method in the delivery order to
2+
ship:
3+
4+
- When the picking is 'Transferred', a *Create Shipping Label* button
5+
appears. Just click on it, and if all went well, the label will be
6+
'attached'.
7+
- If the shipment creation process fails, a validation error will appear
8+
displaying UPS error.
9+
- When the delivery order is cancelled, it's automatically cancelled too
10+
in UPS.
11+
- If you have "Tracking state update sync" checked in the shipping
12+
method, a periodical state check will be done querying UPS services.

delivery_ups_oca/readme/USAGE.rst

-9
This file was deleted.

0 commit comments

Comments
 (0)