本文整理汇总了Python中corehq.apps.commtrack.models.RequisitionCase.open_for_product_case方法的典型用法代码示例。如果您正苦于以下问题:Python RequisitionCase.open_for_product_case方法的具体用法?Python RequisitionCase.open_for_product_case怎么用?Python RequisitionCase.open_for_product_case使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类corehq.apps.commtrack.models.RequisitionCase
的用法示例。
在下文中一共展示了RequisitionCase.open_for_product_case方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: requisition_case_id
# 需要导入模块: from corehq.apps.commtrack.models import RequisitionCase [as 别名]
# 或者: from corehq.apps.commtrack.models.RequisitionCase import open_for_product_case [as 别名]
def requisition_case_id(self):
# for somewhat obscure reasons, the case_id is the id of the
# supply_point_product case, so we add a new field for this.
# though for newly created requisitions it's just empty
if self.base_action_type == RequisitionActions.REQUEST:
return None
if self.base_action_type == RequisitionActions.RECEIPTS:
# for receipts the id should point to the most recent open requisition
# (or none)
try:
product_stock_case = SupplyPointProductCase.get(self.case_id)
return RequisitionCase.open_for_product_case(
self.domain, product_stock_case.location_[-1], self.case_id
)[0]
except IndexError:
# there was no open requisition. this is ok
return None
assert False, "%s is an unexpected action type!" % self.base_action_type