Add ability to add 'description' field to package, not just shipment

seit Januar 2023 muss für den Versand nach Mexiko eine Paketbeschreibung übergeben werden.

UPS schreibt dazu:

Hide quoted text

    However, as of January of 2023, the Mexican Tax Authority adopted the Carta Porte requirements, which mandate that all shipments to and within Mexico include a Package Description field that accurately describes the contents of the shipment.

Sie übergeben die Beschreibung derzeit auf der shipment-Ebene:

},
"carrier": "ups",
"package": {
"type": "parcel",
"width": 20,
"height": 4,
"length": 27,
"weight": 0.48
},
"service": "one_day",
"incoterm": "dap",
"description": "sim cards",
"reference_number": "AM93\\OUT\\07008",
"notification_mail": "roman.rohleder@gmail.com",
"create_shipping_label": true
}

Sie müssen aber sowohl auf shipment-Ebene, als auch auf package-Ebene eine description angeben, damit ein Label erstellt wird.
Z.B.:

},
"carrier": "ups",
"package": {
"type": "parcel",
"width": 20,
"height": 4,
"length": 27,
"weight": 0.48",
"description": "sim cards"
},
"service": "one_day",
"incoterm": "dap",
"description": "sim cards",
"reference_number": "AM93\\OUT\\07008",
"notification_mail": "roman.rohleder@gmail.com",
"create_shipping_label": true
}
This commit is contained in:
Harald Welte 2023-11-28 20:54:37 +01:00
parent 39dc362ed1
commit 38c2442567
2 changed files with 4 additions and 1 deletions

View File

@ -154,7 +154,7 @@ def gen_customs_decl(currency, invoice_nr, net_total, items, importer_ref=None,
return customs_decl
def gen_package(width_cm, length_cm, height_cm, weight_kgs, value=None, currency=None):
def gen_package(width_cm, length_cm, height_cm, weight_kgs, value=None, currency=None, descr=None):
"""Generate a dict for a package in accordance with
https://developers.shipcloud.io/reference/shipments_request_schema.html"""
package = {
@ -171,6 +171,8 @@ def gen_package(width_cm, length_cm, height_cm, weight_kgs, value=None, currency
'amount': value,
'currency': currency,
}
if descr:
package['description'] = descr
return package

View File

@ -93,6 +93,7 @@ class SCDeliveryCarrier(models.Model):
"""Convert an Odoo stock.picking or sale.order into a shipcloud package"""
pkg = {}
pkg['type'] = 'parcel'
pkg['description'] = picking.sc_content_desc
if picking:
pkg['weight'] = self._get_weight_with_tare(order, picking)
pkg['length'] = picking.packaging_length