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


Python Pool.cancel方法代码示例

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


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

示例1: process_state_using_ps_data

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import cancel [as 别名]
    def process_state_using_ps_data(self, order_state):
        """Process Sale state as per the current state

        :param order_state: Site order state corresponding to ps order state
        """
        Sale = Pool().get('sale.sale')

        # Do not process sale if sale has exception
        if self.has_channel_exception:
            return

        self.channel.get_prestashop_client()

        # Cancel the order if its cancelled on prestashop
        if order_state.order_state == 'sale.cancel':
            Sale.cancel([self])
            return

        # Confirm and process the order in any other case
        Sale.quote([self])
        Sale.confirm([self])

        if order_state.order_state != 'sale.confirmed':
            # XXX: To mark sale as Done, sale must be in Processing state
            # as marking sale as Done is part of transition workflow now,
            # which allows only processed sale to be marked as Done.
            # But not sure if calling proceed before process is the right
            # way to do.
            Sale.proceed([self])
            Sale.process([self])
开发者ID:openlabs,项目名称:trytond-prestashop,代码行数:32,代码来源:sale.py

示例2: cancel_move

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import cancel [as 别名]
 def cancel_move(cls, lines):
     Move = Pool().get('stock.move')
     Move.cancel([l.move for l in lines if l.move])
     Move.delete([l.move for l in lines if l.move])
     cls.write([l for l in lines if l.move], {
         'move': None,
         })
开发者ID:ferjavrec,项目名称:stock,代码行数:9,代码来源:inventory.py

示例3: cancel

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import cancel [as 别名]
    def cancel(cls, payments):
        """
        Cancel all payment transactions related to payment
        """
        PaymentTransaction = Pool().get('payment_gateway.transaction')

        payment_transactions = []
        for payment in payments:
            payment_transactions.extend(payment.payment_transactions)

        PaymentTransaction.cancel(payment_transactions)
开发者ID:prakashpp,项目名称:trytond-sale-payment-gateway,代码行数:13,代码来源:payment.py

示例4: _clear_cart

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import cancel [as 别名]
    def _clear_cart(self):
        """
        Clear the shopping cart by deleting both the sale associated
        with it and the cart itself.
        """
        Sale = Pool().get('sale.sale')

        if self.sale:
            Sale.cancel([self.sale])
            Sale.delete([self.sale])
        self.__class__.delete([self])
开发者ID:PritishC,项目名称:nereid-cart-b2c,代码行数:13,代码来源:cart.py

示例5: _clear_cart

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import cancel [as 别名]
    def _clear_cart(self):
        """
        Clear the shopping cart by deleting both the sale associated
        with it and the cart itself.
        """
        Sale = Pool().get('sale.sale')

        if self.sale:
            Sale.cancel([self.sale])
            Sale.delete([self.sale])
        if self.id is not None:
            # An unsaved active record ?
            self.__class__.delete([self])
开发者ID:2cadz,项目名称:nereid-cart-b2c,代码行数:15,代码来源:cart.py

示例6: process_sale_using_magento_state

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import cancel [as 别名]
    def process_sale_using_magento_state(self, magento_state):
        """
        Process the sale in tryton based on the state of order
        when its imported from magento

        :param magento_state: State on magento the order was imported in
        """
        Sale = Pool().get('sale.sale')

        data = MagentoOrderState.get_tryton_state(magento_state)

        # If order is canceled, just cancel it
        if data['tryton_state'] == 'sale.cancel':
            Sale.cancel([self])
            return

        # Order is not canceled, move it to quotation
        Sale.quote([self])
        Sale.confirm([self])

        if data['tryton_state'] not in ['sale.quotation', 'sale.confirmed']:
            Sale.process([self])
开发者ID:GauravButola,项目名称:trytond-magento,代码行数:24,代码来源:sale.py

示例7: cancel

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import cancel [as 别名]
 def cancel(cls, shipments):
     Move = Pool().get('stock.move')
     Move.cancel([m for s in shipments for m in s.moves])
开发者ID:silpol,项目名称:tryton-bef,代码行数:5,代码来源:stock.py

示例8: cancel

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import cancel [as 别名]
 def cancel(cls, shipments):
     Move = Pool().get('stock.move')
     Move.cancel([m for s in shipments for m in s.supplier_moves])
     Move.write([m for s in shipments for m in s.customer_moves],
         {'shipment': None})
开发者ID:kret0s,项目名称:gnuhealth-live,代码行数:7,代码来源:stock.py

示例9: cancel_move

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import cancel [as 别名]
 def cancel_move(cls, lines):
     Move = Pool().get('stock.move')
     moves = [m for l in lines for m in l.moves if l.moves]
     Move.cancel(moves)
     Move.delete(moves)
开发者ID:geneos,项目名称:policoop_ems,代码行数:7,代码来源:policoop_ems.py


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