本文整理汇总了Python中ups.shipping_package.ShipmentConfirm.insured_value_type方法的典型用法代码示例。如果您正苦于以下问题:Python ShipmentConfirm.insured_value_type方法的具体用法?Python ShipmentConfirm.insured_value_type怎么用?Python ShipmentConfirm.insured_value_type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ups.shipping_package.ShipmentConfirm
的用法示例。
在下文中一共展示了ShipmentConfirm.insured_value_type方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _get_ups_packages
# 需要导入模块: from ups.shipping_package import ShipmentConfirm [as 别名]
# 或者: from ups.shipping_package.ShipmentConfirm import insured_value_type [as 别名]
def _get_ups_packages(self):
"""
Return UPS Packages XML
"""
UPSConfiguration = Pool().get('ups.configuration')
ups_config = UPSConfiguration(1)
package_type = ShipmentConfirm.packaging_type(
Code=self.ups_package_type
) # FIXME: Support multiple packaging type
weight = self.package_weight.quantize(
Decimal('.01'), rounding=ROUND_UP
)
package_weight = ShipmentConfirm.package_weight_type(
Weight=str(weight),
Code=ups_config.weight_uom_code,
)
package_service_options = ShipmentConfirm.package_service_options_type(
ShipmentConfirm.insured_value_type(MonetaryValue='0')
)
package_container = ShipmentConfirm.package_type(
package_type,
package_weight,
package_service_options
)
return [package_container]
示例2: get_ups_package_container
# 需要导入模块: from ups.shipping_package import ShipmentConfirm [as 别名]
# 或者: from ups.shipping_package.ShipmentConfirm import insured_value_type [as 别名]
def get_ups_package_container(self):
"""
Return UPS package container for a single package
"""
shipment = self.shipment
carrier = shipment.carrier
if self.box_type:
code = self.box_type.code
length = self.box_type.length
height = self.box_type.height
width = self.box_type.width
dimensions_symbol = self.box_type.distance_unit and \
self.box_type.distance_unit.symbol.upper()
else:
code = '02'
length = self.length
height = self.height
width = self.width
dimensions_symbol = self.distance_unit and \
self.distance_unit.symbol.upper()
package_type = ShipmentConfirm.packaging_type(Code=code)
package_weight = ShipmentConfirm.package_weight_type(
Weight="%.2f" % self.weight,
Code=carrier.ups_weight_uom_code,
)
package_service_options = ShipmentConfirm.package_service_options_type(
ShipmentConfirm.insured_value_type(MonetaryValue='0')
)
args = [package_type, package_weight, package_service_options]
# Only send dimensions if the box type is 'Customer Supplied Package'
if code == '02' and length and width and height and dimensions_symbol:
package_dimensions = ShipmentConfirm.dimensions_type(
Code=dimensions_symbol,
Length=str(length),
Width=str(width),
Height=str(height)
)
args.append(package_dimensions)
package_container = ShipmentConfirm.package_type(*args)
return package_container
示例3: get_ups_package_container
# 需要导入模块: from ups.shipping_package import ShipmentConfirm [as 别名]
# 或者: from ups.shipping_package.ShipmentConfirm import insured_value_type [as 别名]
def get_ups_package_container(self):
"""
Return UPS package container for a single package
"""
shipment = self.shipment
carrier = shipment.carrier
package_type = ShipmentConfirm.packaging_type(
Code=shipment.ups_package_type
) # FIXME: Support multiple packaging type
package_weight = ShipmentConfirm.package_weight_type(
Weight="%.2f" % self.weight, Code=carrier.ups_weight_uom_code
)
package_service_options = ShipmentConfirm.package_service_options_type(
ShipmentConfirm.insured_value_type(MonetaryValue="0")
)
package_container = ShipmentConfirm.package_type(package_type, package_weight, package_service_options)
return package_container