コード例 #1
0
ファイル: signals.py プロジェクト: hashimoto-hb/commcare-hq
def raise_events(xform, cases):
    requisition_cases = [RequisitionCase.wrap(c._doc) for c in cases if c.type == const.REQUISITION_CASE_TYPE]
    if requisition_cases and requisition_cases[0].requisition_status == RequisitionStatus.APPROVED:
        requisition_approved.send(sender=None, requisitions=requisition_cases)
    if requisition_cases and requisition_cases[0].requisition_status == RequisitionStatus.RECEIVED:
        requisition_receipt.send(sender=None, requisitions=requisition_cases)

    if requisition_cases and requisition_cases[0].requisition_status == RequisitionStatus.REQUESTED:
        requisition_modified.send(sender=None, cases=requisition_cases)
コード例 #2
0
ファイル: signals.py プロジェクト: dszafranek/commcare-hq
def raise_events(xform, cases):
    supply_points = [SupplyPointCase.wrap(c._doc) for c in cases if c.type == const.SUPPLY_POINT_CASE_TYPE]
    case_updates = get_case_updates(xform)
    for sp in supply_points:
        created = any(filter(lambda update: update.id == sp._id and update.creates_case(), case_updates))
        supply_point_modified.send(sender=None, supply_point=sp, created=created)
    requisition_cases = [RequisitionCase.wrap(c._doc) for c in cases if c.type == const.REQUISITION_CASE_TYPE]
    if requisition_cases and requisition_cases[0].requisition_status == RequisitionStatus.APPROVED:
        requisition_approved.send(sender=None, requisitions=requisition_cases)
    if requisition_cases and requisition_cases[0].requisition_status == RequisitionStatus.RECEIVED:
        requisition_receipt.send(sender=None, requisitions=requisition_cases)

    if requisition_cases and requisition_cases[0].requisition_status == RequisitionStatus.REQUESTED:
        requisition_modified.send(sender=None, cases=requisition_cases)
コード例 #3
0
ファイル: signals.py プロジェクト: thedevelopermw/commcare-hq
def raise_events(xform, cases):
    requisition_cases = [
        RequisitionCase.wrap(c._doc) for c in cases
        if c.type == const.REQUISITION_CASE_TYPE
    ]
    if requisition_cases and requisition_cases[
            0].requisition_status == RequisitionStatus.APPROVED:
        requisition_approved.send(sender=None, requisitions=requisition_cases)
    if requisition_cases and requisition_cases[
            0].requisition_status == RequisitionStatus.RECEIVED:
        requisition_receipt.send(sender=None, requisitions=requisition_cases)

    if requisition_cases and requisition_cases[
            0].requisition_status == RequisitionStatus.REQUESTED:
        requisition_modified.send(sender=None, cases=requisition_cases)
コード例 #4
0
def raise_events(xform, cases):
    """
    Raise requisition events associated with cases
    """
    # todo: nothing calls this and it can be removed today, though openlmis code depends
    # on it being called during case processing
    requisition_cases = [
        RequisitionCase.wrap(c._doc) for c in cases
        if c.type == REQUISITION_CASE_TYPE
    ]
    if requisition_cases and requisition_cases[
            0].requisition_status == RequisitionStatus.APPROVED:
        requisition_approved.send(sender=None, requisitions=requisition_cases)
    if requisition_cases and requisition_cases[
            0].requisition_status == RequisitionStatus.RECEIVED:
        requisition_receipt.send(sender=None, requisitions=requisition_cases)

    if requisition_cases and requisition_cases[
            0].requisition_status == RequisitionStatus.REQUESTED:
        requisition_modified.send(sender=None, cases=requisition_cases)
コード例 #5
0
 def testConfirmDelivery(self):
     requisition_cases = []
     config = self.domain.commtrack_settings
     for spp in self.spps.values():
         transaction = Requisition(
             config=config,
             product_id=spp.product,
             case_id=spp._id,
             action_name=config.get_action_by_type(RequisitionActions.REQUEST).action_name,
             value=20,
         )
         req = create_requisition(self.user._id, spp, transaction)
         requisition_cases.append(req)
     self.assertTrue(requisition_receipt.send(sender=None, requisitions=requisition_cases))