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


Python Pool.done方法代码示例

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


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

示例1: update_order_status_from_amazon_mws

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import done [as 别名]
    def update_order_status_from_amazon_mws(self, order_data=None):
        """Update order status from amazon mws

        :TODO: this only handles shipped orders of amazon mws. Should handle
        other states too?
        """
        Shipment = Pool().get('stock.shipment.out')

        if order_data is None:
            order_api = self.channel.get_amazon_order_api()
            order_data = order_api.get_order(
                [self.channel_identifier]
            ).parsed['Orders']['Order']

        if order_data['OrderStatus']['value'] == "Canceled":
            # TODO
            # If not done
            # - cancel shipment
            # - cancel invoice or credit invoice
            pass

        if order_data['OrderStatus']['value'] == "Shipped":
            # Order is completed on amazon, process shipments and
            # invoices.
            for shipment in self.shipments:
                if shipment.state == 'draft':
                    Shipment.wait([shipment])
                if shipment.state == 'waiting':
                    Shipment.assign([shipment])
                if shipment.state == 'assigned':
                    Shipment.pack([shipment])
                if shipment.state == 'packed':
                    Shipment.done([shipment])
开发者ID:riteshshrv,项目名称:trytond-amazon-mws_old,代码行数:35,代码来源:sale.py

示例2: update_order_status_from_magento

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import done [as 别名]
    def update_order_status_from_magento(self, order_data=None):
        """Update order status from magento.

        :TODO: this only handles complete orders of magento. Should handle
        other states too?
        """
        Shipment = Pool().get('stock.shipment.out')

        if order_data is None:
            # XXX: Magento order_data is already there, so need not to
            # fetch again
            with magento.Order(
                self.channel.magento_url, self.channel.magento_api_user,
                self.channel.magento_api_key
            ) as order_api:
                order_data = order_api.info(self.reference)

        if order_data['status'] == 'complete':
            # Order is completed on magento, process shipments and
            # invoices.
            for shipment in self.shipments:
                if shipment.state == 'draft':
                    Shipment.wait([shipment])
                if shipment.state == 'waiting':
                    Shipment.assign([shipment])
                if shipment.state == 'assigned':
                    Shipment.pack([shipment])
                if shipment.state == 'packed':
                    Shipment.done([shipment])
开发者ID:usudaysingh,项目名称:trytond-magento,代码行数:31,代码来源:sale.py

示例3: process_fba_order

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import done [as 别名]
    def process_fba_order(self):
        """
        Process FBA Orders as they are imported as past orders
        and handle their shipments.
        """
        Sale = Pool().get('sale.sale')
        Shipment = Pool().get('stock.shipment.out')

        Sale.quote([self])
        Sale.confirm([self])
        Sale.process([self])

        for shipment in self.shipments:
            if shipment.state == 'draft':
                Shipment.wait([shipment])
            if shipment.state == 'waiting':
                Shipment.assign([shipment])
            if shipment.state == 'assigned':
                Shipment.pack([shipment])
            if shipment.state == 'packed':
                Shipment.done([shipment])
开发者ID:Jason-Kou,项目名称:trytond-amazon-mws,代码行数:23,代码来源:sale.py


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