本文整理汇总了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])
示例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,
})
示例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)
示例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])
示例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])
示例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])
示例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])
示例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})
示例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)