Exemplo n.º 1
0
 def _process_emergency_soh(self):
     stock_report = create_stock_report(Reports.EMERGENCY_SOH,  
                                        self.hsa.supply_point,
                                        self.report_data, 
                                        self.msg.logger_msg)
     requests = StockRequest.create_from_report(stock_report, self.hsa)
     if stock_report.errors:
         # TODO: respond better.
         self.respond(config.Messages.GENERIC_ERROR)
     else:
         if self.msg.logistics_contact.role == ContactRole.objects.get(code=config.Roles.IN_CHARGE):
             self.respond(config.Messages.REPORT_SOH_RESPONSE,
                      hsa=self.hsa.name,
                      products=", ".join(req.sms_format() for req in requests),
                      hsa_id=self.hsa.supply_point.code)
         else:
             assert(self.msg.logistics_contact.role == ContactRole.objects.get(code=config.Roles.HSA))
             send_emergency_responses(self.msg, self.hsa, stock_report, requests)
Exemplo n.º 2
0
 def _process_emergency_soh(self):
     stock_report = create_stock_report(Reports.EMERGENCY_SOH,
                                        self.hsa.supply_point,
                                        self.report_data,
                                        self.msg.logger_msg)
     requests = StockRequest.create_from_report(stock_report, self.hsa)
     if stock_report.errors:
         # TODO: respond better.
         self.respond(config.Messages.GENERIC_ERROR)
     else:
         if self.msg.logistics_contact.role == ContactRole.objects.get(
                 code=config.Roles.IN_CHARGE):
             self.respond(config.Messages.REPORT_SOH_RESPONSE,
                          hsa=self.hsa.name,
                          products=", ".join(req.sms_format()
                                             for req in requests),
                          hsa_id=self.hsa.supply_point.code)
         else:
             assert (
                 self.msg.logistics_contact.role == ContactRole.objects.get(
                     code=config.Roles.HSA))
             send_emergency_responses(self.msg, self.hsa, stock_report,
                                      requests)
Exemplo n.º 3
0
 def send_responses(self, stock_report):
     send_emergency_responses(self.msg, self.msg.logistics_contact,
                              stock_report, self.requests)
Exemplo n.º 4
0
 def send_responses(self, stock_report):
     send_emergency_responses(self.msg, self.msg.logistics_contact, stock_report, self.requests)