Add wizard to print shipping labels
issue10834 review375701002
This commit is contained in:
1 parent
88f5bf8421
commit
7029633e75
3 files changed
+13
No files matched your search
@@ -103,3 +103,11 @@ class Carrier(metaclass=PoolMeta):
|
||||
'invisible': Eval('shipping_service') != 'ups',
|
||||
}),
|
||||
]
|
||||
|
||||
@property
|
||||
def shipping_label_mimetype(self):
|
||||
mimetype = super().shipping_label_mimetype
|
||||
if self.shipping_service == 'ups':
|
||||
if self.ups_label_image_format == 'GIF':
|
||||
mimetype = 'image/gif'
|
||||
return mimetype
|
||||
@@ -173,6 +173,7 @@ class CreateShippingUPS(Wizard):
|
||||
shipment=shipment.rec_name))
|
||||
|
||||
credential = self.get_credential(shipment)
|
||||
carrier = shipment.carrier
|
||||
packages = shipment.root_packages
|
||||
shipment_request = self.get_request(shipment, packages, credential)
|
||||
api_url = config.get('stock_package_shipping_ups', credential.server,
|
||||
@@ -227,6 +228,8 @@ class CreateShippingUPS(Wizard):
|
||||
ups_pkg['ShippingLabel']['GraphicImage']))
|
||||
tryton_pkg.shipping_reference = ups_pkg['TrackingNumber']
|
||||
tryton_pkg.shipping_label = label
|
||||
tryton_pkg.shipping_label_mimetype = (
|
||||
carrier.shipping_label_mimetype)
|
||||
Package.save(packages)
|
||||
shipment.save()
|
||||
|
||||
|
||||
@@ -223,6 +223,8 @@ Create the packs and ship the shipment::
|
||||
>>> pack, = shipment.root_packages
|
||||
>>> pack.shipping_label is not None
|
||||
True
|
||||
>>> pack.shipping_label_mimetype
|
||||
'image/gif'
|
||||
>>> pack.shipping_reference is not None
|
||||
True
|
||||
>>> pack.shipping_tracking_url.startswith('https://www.ups.com/track?')
|
||||
|
||||
Reference in new issue
Block a user