当前位置: 首页>>代码示例>>Python>>正文


Python ShipmentConfirm.package_service_options_type方法代码示例

本文整理汇总了Python中ups.shipping_package.ShipmentConfirm.package_service_options_type方法的典型用法代码示例。如果您正苦于以下问题:Python ShipmentConfirm.package_service_options_type方法的具体用法?Python ShipmentConfirm.package_service_options_type怎么用?Python ShipmentConfirm.package_service_options_type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ups.shipping_package.ShipmentConfirm的用法示例。


在下文中一共展示了ShipmentConfirm.package_service_options_type方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _get_ups_packages

# 需要导入模块: from ups.shipping_package import ShipmentConfirm [as 别名]
# 或者: from ups.shipping_package.ShipmentConfirm import package_service_options_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]
开发者ID:mbehrle,项目名称:trytond-shipping-ups,代码行数:29,代码来源:stock.py

示例2: get_ups_package_container

# 需要导入模块: from ups.shipping_package import ShipmentConfirm [as 别名]
# 或者: from ups.shipping_package.ShipmentConfirm import package_service_options_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
开发者ID:fulfilio,项目名称:trytond-shipping-ups,代码行数:47,代码来源:stock.py

示例3: get_ups_package_container

# 需要导入模块: from ups.shipping_package import ShipmentConfirm [as 别名]
# 或者: from ups.shipping_package.ShipmentConfirm import package_service_options_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
开发者ID:riteshshrv,项目名称:trytond-shipping-ups,代码行数:21,代码来源:stock.py


注:本文中的ups.shipping_package.ShipmentConfirm.package_service_options_type方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。