本文整理汇总了Python中trytond.pool.Pool.assign方法的典型用法代码示例。如果您正苦于以下问题:Python Pool.assign方法的具体用法?Python Pool.assign怎么用?Python Pool.assign使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类trytond.pool.Pool
的用法示例。
在下文中一共展示了Pool.assign方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update_order_status_from_amazon_mws
# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import assign [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])
示例2: update_order_status_from_magento
# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import assign [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])
示例3: process_fba_order
# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import assign [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])