Update to DPD Shipment Service 4.4
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
* Update to Shipment Service 4.4
|
||||
* Support international shipping
|
||||
|
||||
Version 7.6.0 - 2025-04-28
|
||||
--------------------------
|
||||
|
||||
@@ -80,19 +80,19 @@ class Carrier(metaclass=PoolMeta):
|
||||
('E12', "DPD 12:00"),
|
||||
('E18', "DPD 18:00"),
|
||||
('IE2', "DPD EXPRESS"),
|
||||
('PL', "DPD PARCEL Letter"),
|
||||
('PL+', "DPD PARCEL Letter Plus"),
|
||||
('MAIL', "DPD International Mail"),
|
||||
('MAX', "DPD MAX"),
|
||||
('PL', "DPD PARCEL Letter"),
|
||||
('PM4', "DPD Priority"),
|
||||
], "Product", sort=False, translate=False,
|
||||
states={
|
||||
'required': Eval('shipping_service') == 'dpd',
|
||||
'invisible': Eval('shipping_service') != 'dpd',
|
||||
})
|
||||
dpd_printer_language = fields.Selection([
|
||||
dpd_output_format = fields.Selection([
|
||||
(None, ''),
|
||||
('PDF', "PDF"),
|
||||
('ZPL', "ZPL"),
|
||||
], "Printer Language", sort=False, translate=False,
|
||||
], "Output Format", sort=False, translate=False,
|
||||
states={
|
||||
'required': Eval('shipping_service') == 'dpd',
|
||||
'invisible': Eval('shipping_service') != 'dpd',
|
||||
@@ -124,6 +124,15 @@ class Carrier(metaclass=PoolMeta):
|
||||
super().__setup__()
|
||||
cls.shipping_service.selection.append(('dpd', 'DPD'))
|
||||
|
||||
@classmethod
|
||||
def __register__(cls, module):
|
||||
table_h = cls.__table_handler__(module)
|
||||
|
||||
# Migration from 7.4: rename dpd_printer_language to dpd_output_format
|
||||
table_h.column_rename('dpd_printer_language', 'dpd_output_format')
|
||||
|
||||
super().__register__(module)
|
||||
|
||||
@classmethod
|
||||
def view_attributes(cls):
|
||||
return super().view_attributes() + [
|
||||
|
||||
@@ -13,7 +13,7 @@ SERVER_URLS = {
|
||||
}
|
||||
|
||||
LOGIN_SERVICE = 'LoginService/V2_0/?wsdl'
|
||||
SHIPMENT_SERVICE = 'ShipmentService/V3_2/?wsdl'
|
||||
SHIPMENT_SERVICE = 'ShipmentService/V4_4/?wsdl'
|
||||
|
||||
|
||||
def get_client(server, service):
|
||||
|
||||
@@ -6,7 +6,7 @@ using the DPD webservices.
|
||||
DPD has many different web services, the module supports:
|
||||
|
||||
- `LoginService 2.0 <https://esolutions.dpd.com/dokumente/LoginService_V2_0.pdf>`_
|
||||
- `ShipmentService 3.2 <https://esolutions.dpd.com/dokumente/ShipmentService_V3_2.pdf>`_
|
||||
- `ShipmentService 4.4 <https://esolutions.dpd.com/dokumente/ShipmentService_V4_4.pdf>`_
|
||||
|
||||
Carrier Credential
|
||||
******************
|
||||
|
||||
@@ -161,7 +161,7 @@ class CreateDPDShipping(Wizard):
|
||||
message=message))
|
||||
|
||||
labels = []
|
||||
labels_pdf = BytesIO(shipment_response.parcellabelsPDF)
|
||||
labels_pdf = BytesIO(shipment_response.output.content)
|
||||
reader = PdfReader(labels_pdf)
|
||||
for page in iter_pdf_pages(reader):
|
||||
new_pdf = PdfWriter()
|
||||
@@ -198,8 +198,11 @@ class CreateDPDShipping(Wizard):
|
||||
|
||||
def get_print_options(self, shipment):
|
||||
return {
|
||||
'printerLanguage': shipment.carrier.dpd_printer_language,
|
||||
'paperFormat': shipment.carrier.dpd_paper_format,
|
||||
'printOption': [{
|
||||
'outputFormat': shipment.carrier.dpd_output_format,
|
||||
'paperFormat': shipment.carrier.dpd_paper_format,
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
def shipping_party(self, party, address, usage=None):
|
||||
@@ -210,21 +213,24 @@ class CreateDPDShipping(Wizard):
|
||||
street = address.street_name or ''
|
||||
house_no = address.numbers
|
||||
shipping_party = {
|
||||
'name1': address.party_full_name[:35],
|
||||
'name1': address.party_full_name[:50],
|
||||
'name2': '',
|
||||
'street': street[:35],
|
||||
'street': street[:50],
|
||||
'houseNo': house_no[:8],
|
||||
'country': address.country.code if address.country else '',
|
||||
'zipCode': address.postal_code[:9],
|
||||
'city': address.city[:35],
|
||||
'city': address.city[:50],
|
||||
'contact': party.full_name[:35],
|
||||
}
|
||||
|
||||
phone = address.contact_mechanism_get({'phone', 'mobile'}, usage=usage)
|
||||
if phone and len(phone.value) <= 30:
|
||||
shipping_party['phone'] = phone.value
|
||||
mobile = address.contact_mechanism_get('mobile', usage=usage)
|
||||
if mobile and len(mobile.value) <= 30:
|
||||
shipping_party['mobile'] = mobile.value
|
||||
email = address.contact_mechanism_get('email', usage=usage)
|
||||
if email and len(email.value) <= 50:
|
||||
if email and 5 <= len(email.value) <= 100:
|
||||
shipping_party['email'] = email.value
|
||||
|
||||
return shipping_party
|
||||
@@ -256,7 +262,7 @@ class CreateDPDShipping(Wizard):
|
||||
package.width_uom, package.width, cm, round=False))
|
||||
height = ceil(UoM.compute_qty(
|
||||
package.height_uom, package.height, cm, round=False))
|
||||
if length < 1000 and width < 1000 and height < 1000:
|
||||
if 1 <= length < 1000 and 1 <= width < 1000 and 1 <= height < 1000:
|
||||
parcel['volume'] = int(
|
||||
'%03i%03i%03i' % (length, width, height))
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ Create a DPD Carrier and the related credential::
|
||||
>>> carrier.carrier_product = carrier_product
|
||||
>>> carrier.shipping_service = 'dpd'
|
||||
>>> carrier.dpd_product = 'CL'
|
||||
>>> carrier.dpd_printer_language = 'PDF'
|
||||
>>> carrier.dpd_output_format = 'PDF'
|
||||
>>> carrier.dpd_paper_format = 'A6'
|
||||
>>> carrier.dpd_notification = 'sms'
|
||||
>>> carrier.save()
|
||||
|
||||
@@ -9,8 +9,8 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<label name="dpd_notification"/>
|
||||
<field name="dpd_notification"/>
|
||||
|
||||
<label name="dpd_printer_language"/>
|
||||
<field name="dpd_printer_language"/>
|
||||
<label name="dpd_output_format"/>
|
||||
<field name="dpd_output_format"/>
|
||||
<label name="dpd_paper_format"/>
|
||||
<field name="dpd_paper_format"/>
|
||||
</xpath>
|
||||
|
||||
Reference in New Issue
Block a user