Skip to content

Commit 98e6a31

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

7 files changed

Lines changed: 107 additions & 100 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/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)