Skip to content

Commit b1ae1c3

Browse files
committed
[IMP] delivery_cbl: add option to configure cbl_freight_type. Prepaid (P) or Collect (D)
1 parent 1dc0fa9 commit b1ae1c3

10 files changed

Lines changed: 160 additions & 134 deletions

File tree

delivery_cbl/README.rst

Lines changed: 61 additions & 61 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 CBL
73
============
@@ -17,7 +13,7 @@ Delivery CBL
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%2Fdelivery--carrier-lightgray.png?logo=github
@@ -37,12 +33,12 @@ available carriers.
3733

3834
The following operations are supported:
3935

40-
- Register shippings
41-
- Generate shipping labels when shippings are registered. The PDF is
42-
generated using the labelary API (http://api.labelary.com/).
43-
- Validate shippings (both manually and automatically)
44-
- Cancel shippings
45-
- Generate de CBL Manifest
36+
- Register shippings
37+
- Generate shipping labels when shippings are registered. The PDF is
38+
generated using the labelary API (http://api.labelary.com/).
39+
- Validate shippings (both manually and automatically)
40+
- Cancel shippings
41+
- Generate the CBL Manifest
4642

4743
**Table of contents**
4844

@@ -56,9 +52,12 @@ To configure this module, you need to:
5652

5753
1. Add a Shipping Method with Provider ``CBL`` and introduce the User,
5854
Password, Client Code and Client Token.
59-
2. Activate the "Cash On Delivery" option if shippings are paid by cash,
55+
2. Choose the "Collect" "Freight Type" if the delivery needs to be paid
56+
by the receiver, or the "Prepaid" type if it needs to be paid by the
57+
shipper.
58+
3. Activate the "Cash On Delivery" option if shippings are paid by cash,
6059
assuming that the picking has a related sales order.
61-
3. Activate the "Needs Confirmation" option if shippings need to be
60+
4. Activate the "Needs Confirmation" option if shippings need to be
6261
confirmed after the tracking number is created in order to be
6362
oficially included in the CBL pending shippings database. It is
6463
crucial to have the same configuration both in Odoo and in your CBL
@@ -73,55 +72,56 @@ Usage
7372
To carry out the shipment, the shipping method previously created must
7473
be set on the delivery order:
7574

76-
- Once the outgoing delivery is “Validated (Done)", the shipping
77-
information is automatically transmitted to CBL. If everything is
78-
correct, a tracking number and the corresponding labels are generated.
79-
- Shipments can be cancelled by clicking the "Cancel" button located
80-
next to the picking's tracking number. Keep in mind that using a
81-
carrier with the "Needs Confirmation" option unchecked, while having
82-
the opposite configuration set in CBL, may cause issues when
83-
attempting to cancel a shipment. In such cases, contact CBL so they
84-
can adjust the confirmation policy accordingly.
85-
- If a shipment could not be generated or has been cancelled, a new one
86-
can be created by clicking the "Send to Shipper" button at the top of
87-
the stock picking.
88-
- Shipments that require confirmation after the tracking number has been
89-
assigned can be confirmed as follows:
90-
91-
- Individually: By clicking the "Confirm" button in the "Tracking
92-
Number" field, located under the "Additional Info" tab within the
93-
"Shipping Information" section.
94-
- [Improved] Bulk method: In the list view of outgoing deliveries,
95-
select all deliveries for the carrier whose status is “Validated
96-
(Done)", click the "Actions" gear icon → "Confirm CBL pickings". A
97-
wizard will appear listing the deliveries to be confirmed. Verify
98-
that all required pickings are included, then click the "Confirm
99-
Shipments" button.
100-
- Additionally, there is a scheduled action ("CBL: Confirm Shipments")
101-
that automatically validates pending CBL shipments once per day by
102-
default.
103-
104-
- To generate the manifest, you need to Inventory > Operation >
105-
Manifest, select a CBL carrier and set the date range to select the
106-
picking.
75+
- Once the outgoing delivery is “Validated (Done)", the shipping
76+
information is automatically transmitted to CBL. If everything is
77+
correct, a tracking number and the corresponding labels are
78+
generated.
79+
- Shipments can be cancelled by clicking the "Cancel" button located
80+
next to the picking's tracking number. Keep in mind that using a
81+
carrier with the "Needs Confirmation" option unchecked, while having
82+
the opposite configuration set in CBL, may cause issues when
83+
attempting to cancel a shipment. In such cases, contact CBL so they
84+
can adjust the confirmation policy accordingly.
85+
- If a shipment could not be generated or has been cancelled, a new one
86+
can be created by clicking the "Send to Shipper" button at the top of
87+
the stock picking.
88+
- Shipments that require confirmation after the tracking number has
89+
been assigned can be confirmed as follows:
90+
91+
- Individually: By clicking the "Confirm" button in the "Tracking
92+
Number" field, located under the "Additional Info" tab within the
93+
"Shipping Information" section.
94+
- [Improved] Bulk method: In the list view of outgoing deliveries,
95+
select all deliveries for the carrier whose status is “Validated
96+
(Done)", click the "Actions" gear icon → "Confirm CBL pickings". A
97+
wizard will appear listing the deliveries to be confirmed. Verify
98+
that all required pickings are included, then click the "Confirm
99+
Shipments" button.
100+
- Additionally, there is a scheduled action ("CBL: Confirm
101+
Shipments") that automatically validates pending CBL shipments
102+
once per day by default.
103+
104+
- To generate the manifest, you need to Inventory > Operation >
105+
Manifest, select a CBL carrier and set the date range to select the
106+
picking.
107107

108108
Known issues / Roadmap
109109
======================
110110

111-
- During the development of the shipping label generation feature, we
112-
initially evaluated the use of the Zebrafy library to convert ZPL
113-
labels into PDF format. However, Zebrafy is based on the presence of
114-
graphic fields (^GF) in the ZPL source, which are not always included
115-
in the labels generated by CBL.
116-
- To ensure broader compatibility, it's opted to use the external
117-
service Labelary.com, returns the corresponding label in PDF format
118-
via an HTTP request.
119-
- To provide flexibility, a new field cbl_label_format has been added to
120-
the delivery.carrier model, allowing the user to select between ZPL
121-
(default) and PDF formats. The method cdl_generate_labels will only
122-
invoke the external Labelary service if the selected format is PDF.
123-
Otherwise, the label is stored directly in ZPL format without any
124-
transformation.
111+
- During the development of the shipping label generation feature, we
112+
initially evaluated the use of the Zebrafy library to convert ZPL
113+
labels into PDF format. However, Zebrafy is based on the presence of
114+
graphic fields (^GF) in the ZPL source, which are not always included
115+
in the labels generated by CBL.
116+
- To ensure broader compatibility, it's opted to use the external
117+
service Labelary.com, returns the corresponding label in PDF format
118+
via an HTTP request.
119+
- To provide flexibility, a new field cbl_label_format has been added
120+
to the delivery.carrier model, allowing the user to select between
121+
ZPL (default) and PDF formats. The method cdl_generate_labels will
122+
only invoke the external Labelary service if the selected format is
123+
PDF. Otherwise, the label is stored directly in ZPL format without
124+
any transformation.
125125

126126
Bug Tracker
127127
===========
@@ -144,9 +144,9 @@ Authors
144144
Contributors
145145
------------
146146

147-
- Manuel Regidor manuel.regidor@sygel.es
148-
- Valentín Vinagre valentin.vinagre@sygel.es
149-
- Ángel Rivas angel.rivas@sygel.es
147+
- Manuel Regidor manuel.regidor@sygel.es
148+
- Valentín Vinagre valentin.vinagre@sygel.es
149+
- Ángel Rivas angel.rivas@sygel.es
150150

151151
Maintainers
152152
-----------

delivery_cbl/i18n/delivery_cbl.pot

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ msgid ""
66
msgstr ""
77
"Project-Id-Version: Odoo Server 17.0\n"
88
"Report-Msgid-Bugs-To: \n"
9+
"POT-Creation-Date: 2025-10-27 15:02+0000\n"
10+
"PO-Revision-Date: 2025-10-27 15:02+0000\n"
911
"Last-Translator: \n"
1012
"Language-Team: \n"
1113
"MIME-Version: 1.0\n"
@@ -188,6 +190,21 @@ msgid ""
188190
"If PDF is selected, labels will be generated using an external service (labelary.com)."
189191
msgstr ""
190192

193+
#. module: delivery_cbl
194+
#: model:ir.model.fields.selection,name:delivery_cbl.selection__delivery_carrier__cbl_freight_type__d
195+
msgid "Freight Collect"
196+
msgstr ""
197+
198+
#. module: delivery_cbl
199+
#: model:ir.model.fields.selection,name:delivery_cbl.selection__delivery_carrier__cbl_freight_type__p
200+
msgid "Freight Prepaid"
201+
msgstr ""
202+
203+
#. module: delivery_cbl
204+
#: model:ir.model.fields,field_description:delivery_cbl.field_delivery_carrier__cbl_freight_type
205+
msgid "Freight Type"
206+
msgstr ""
207+
191208
#. module: delivery_cbl
192209
#: model:ir.model.fields,field_description:delivery_cbl.field_wizard_confirm_cbl_pickings__id
193210
msgid "ID"

delivery_cbl/i18n/es.po

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ msgid ""
66
msgstr ""
77
"Project-Id-Version: Odoo Server 17.0\n"
88
"Report-Msgid-Bugs-To: \n"
9-
"POT-Creation-Date: 2025-07-01 13:21+0000\n"
10-
"PO-Revision-Date: 2025-07-01 15:23+0200\n"
9+
"POT-Creation-Date: 2025-10-27 15:03+0000\n"
10+
"PO-Revision-Date: 2025-10-27 16:04+0100\n"
1111
"Last-Translator: \n"
1212
"Language-Team: \n"
1313
"Language: es\n"
1414
"MIME-Version: 1.0\n"
1515
"Content-Type: text/plain; charset=UTF-8\n"
1616
"Content-Transfer-Encoding: 8bit\n"
17-
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
18-
"X-Generator: Poedit 3.6\n"
17+
"Plural-Forms: \n"
18+
"X-Generator: Poedit 3.0.1\n"
1919

2020
#. module: delivery_cbl
2121
#: model_terms:ir.ui.view,arch_db:delivery_cbl.report_cbl_manifest
@@ -102,11 +102,8 @@ msgstr "Se ha cancelado la expedición de CBL con referencia %(tracking)s."
102102
#. odoo-python
103103
#: code:addons/delivery_cbl/models/cbl_request.py:0
104104
#, python-format
105-
msgid ""
106-
"CBL Shipping for picking %(picking)s could not be created. Reason: %(reason)s"
107-
msgstr ""
108-
"El envío de CBL para el albarán %(picking)s no se pudo crear. Razón: "
109-
"%(reason)s"
105+
msgid "CBL Shipping for picking %(picking)s could not be created. Reason: %(reason)s"
106+
msgstr "El envío de CBL para el albarán %(picking)s no se pudo crear. Razón: %(reason)s"
110107

111108
#. module: delivery_cbl
112109
#. odoo-python
@@ -158,13 +155,11 @@ msgstr ""
158155

159156
#. module: delivery_cbl
160157
#: model_terms:ir.ui.view,arch_db:delivery_cbl.wizard_confirm_cbl_pickings
161-
#, fuzzy
162158
msgid "Confirm Shipments"
163159
msgstr "CBL: Confirmar envíos"
164160

165161
#. module: delivery_cbl
166162
#: model:ir.actions.act_window,name:delivery_cbl.action_wizard_confirm_cbl_pickings
167-
#, fuzzy
168163
msgid "Confirm pickings"
169164
msgstr "Confirmar"
170165

@@ -192,12 +187,25 @@ msgstr ""
192187
#: model:ir.model.fields,help:delivery_cbl.field_delivery_carrier__cbl_label_format
193188
msgid ""
194189
"Format to generate shipping labels.\n"
195-
"If PDF is selected, labels will be generated using an external service "
196-
"(labelary.com)."
190+
"If PDF is selected, labels will be generated using an external service (labelary.com)."
197191
msgstr ""
198192
"Formato para generar etiquetas de envío.\n"
199-
"Si se selecciona PDF, las etiquetas se generarán utilizando un servicio "
200-
"externo (labelary.com)."
193+
"Si se selecciona PDF, las etiquetas se generarán utilizando un servicio externo (labelary.com)."
194+
195+
#. module: delivery_cbl
196+
#: model:ir.model.fields.selection,name:delivery_cbl.selection__delivery_carrier__cbl_freight_type__d
197+
msgid "Freight Collect"
198+
msgstr "Portes debidos"
199+
200+
#. module: delivery_cbl
201+
#: model:ir.model.fields.selection,name:delivery_cbl.selection__delivery_carrier__cbl_freight_type__p
202+
msgid "Freight Prepaid"
203+
msgstr "Portes pagados"
204+
205+
#. module: delivery_cbl
206+
#: model:ir.model.fields,field_description:delivery_cbl.field_delivery_carrier__cbl_freight_type
207+
msgid "Freight Type"
208+
msgstr "Tipo de portes"
201209

202210
#. module: delivery_cbl
203211
#: model:ir.model.fields,field_description:delivery_cbl.field_wizard_confirm_cbl_pickings__id
@@ -207,22 +215,20 @@ msgstr ""
207215
#. module: delivery_cbl
208216
#: model:ir.model.fields,help:delivery_cbl.field_delivery_carrier__cbl_needs_confirmation
209217
msgid ""
210-
"If checked, expeditions need to be confirmed after the tracking number is "
211-
"generated to be officially introduced in CBL pending shipments database."
218+
"If checked, expeditions need to be confirmed after the tracking number is generated to be "
219+
"officially introduced in CBL pending shipments database."
212220
msgstr ""
213-
"Si está marcado, las expediciones necesitan confirmarse tras la creación de "
214-
"su número de seguimiento para que se introduzcan oficialmente en la base de "
215-
"datos de CBL."
221+
"Si está marcado, las expediciones necesitan confirmarse tras la creación de su número de "
222+
"seguimiento para que se introduzcan oficialmente en la base de datos de CBL."
216223

217224
#. module: delivery_cbl
218225
#: model:ir.model.fields,help:delivery_cbl.field_delivery_carrier__cbl_cash_on_delivery
219226
msgid ""
220-
"If checked, it means that the carrier is paid with cash. It assumes there is "
221-
"a sale order linked and it will use that total amount as the value to be paid"
227+
"If checked, it means that the carrier is paid with cash. It assumes there is a sale order "
228+
"linked and it will use that total amount as the value to be paid"
222229
msgstr ""
223-
"Si está marcado, significa que al transportista se le paga en cash. Se asuma "
224-
"que hay un pedido de venta relacionado y se utilizará su cantidad total como "
225-
"la cantidad que tiene que pagarse."
230+
"Si está marcado, significa que al transportista se le paga en cash. Se asuma que hay un pedido "
231+
"de venta relacionado y se utilizará su cantidad total como la cantidad que tiene que pagarse."
226232

227233
#. module: delivery_cbl
228234
#: model:ir.model.fields,field_description:delivery_cbl.field_delivery_carrier__cbl_label_format
@@ -286,20 +292,18 @@ msgstr "No hay albaranes para procesar"
286292
#. module: delivery_cbl
287293
#: model:ir.model,name:delivery_cbl.model_stock_picking
288294
msgid "Transfer"
289-
msgstr "Traslado"
295+
msgstr "Transferencia"
290296

291297
#. module: delivery_cbl
292298
#. odoo-python
293299
#: code:addons/delivery_cbl/models/delivery_carrier.py:0
294300
#, python-format
295301
msgid ""
296-
"Unable to cancel CBL Expedition with reference %(tracking)s. Please, make "
297-
"sure that the reference is correct and the expedition has not been already "
298-
"canceled."
302+
"Unable to cancel CBL Expedition with reference %(tracking)s. Please, make sure that the "
303+
"reference is correct and the expedition has not been already canceled."
299304
msgstr ""
300-
"No se ha podido cancelar la expedición de CBL con referencia %(tracking)s. "
301-
"Por favor, asegúrate de que la referencia es correcta y que la expedición no "
302-
"se ha cancelado previamente."
305+
"No se ha podido cancelar la expedición de CBL con referencia %(tracking)s. Por favor, "
306+
"asegúrate de que la referencia es correcta y que la expedición no se ha cancelado previamente."
303307

304308
#. module: delivery_cbl
305309
#: model:ir.model.fields,field_description:delivery_cbl.field_delivery_carrier__cbl_user

delivery_cbl/models/cbl_request.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,10 @@ def _generate_shipping_json(self, picking, daily_token):
105105
"numPackages": len(packages),
106106
"weight": picking.shipping_weight,
107107
"packages": packages,
108+
"freight": picking.carrier_id.cbl_freight_type,
108109
}
109110
if picking.carrier_id.cbl_cash_on_delivery and picking.sale_id:
110-
vals.update(
111-
{"cashOnDelivery": picking.sale_id.amount_total, "freight": "P"}
112-
)
113-
else:
114-
vals.update({"freight": "D"})
111+
vals.update({"cashOnDelivery": picking.sale_id.amount_total})
115112
return vals
116113

117114
def _send_shipping(self, picking):

delivery_cbl/models/delivery_carrier.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ class DeliveryCarrier(models.Model):
2626
"total amount as the value to be paid"
2727
),
2828
)
29+
cbl_freight_type = fields.Selection(
30+
string="Freight Type",
31+
selection=[
32+
("D", "Freight Collect"),
33+
("P", "Freight Prepaid"),
34+
],
35+
required=True,
36+
default="D",
37+
)
2938
cbl_needs_confirmation = fields.Boolean(
3039
string="Needs Confirmation",
3140
help=(

delivery_cbl/readme/CONFIGURE.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ To configure this module, you need to:
22

33
1. Add a Shipping Method with Provider ``CBL`` and introduce the User,
44
Password, Client Code and Client Token.
5-
2. Activate the "Cash On Delivery" option if shippings are paid by cash,
5+
2. Choose the "Collect" "Freight Type" if the delivery needs to be paid by the receiver,
6+
or the "Prepaid" type if it needs to be paid by the shipper.
7+
3. Activate the "Cash On Delivery" option if shippings are paid by cash,
68
assuming that the picking has a related sales order.
7-
3. Activate the "Needs Confirmation" option if shippings need to be
9+
4. Activate the "Needs Confirmation" option if shippings need to be
810
confirmed after the tracking number is created in order to be oficially
911
included in the CBL pending shippings database. It is crucial to have
1012
the same configuration both in Odoo and in your CBL account. Contact

delivery_cbl/readme/DESCRIPTION.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ The following operations are supported:
77
the labelary API (http://api.labelary.com/).
88
- Validate shippings (both manually and automatically)
99
- Cancel shippings
10-
- Generate de CBL Manifest
10+
- Generate the CBL Manifest

0 commit comments

Comments
 (0)