def testCreateVirtualFacility(self): loc = Location(site_code='1234', name='beavis', domain=self.domain, location_type='chw') loc.save() sp = make_supply_point(self.domain, loc) self.assertTrue(sync_supply_point_to_openlmis(sp, self.api)) self.assertTrue(sync_supply_point_to_openlmis(sp, self.api, False))
def supply_point_updated(sender, supply_point, created, **kwargs): project = Domain.get_by_name(supply_point.domain) if project.commtrack_enabled and project.commtrack_settings.openlmis_enabled: # check if supply_point is of 'chw type' if supply_point.location and supply_point.location.location_type == "chw": #check if supply_point is linked to an OpenLMIS facility if supply_point.location.lineage and len(supply_point.location.lineage) > 0: endpoint = OpenLMISEndpoint.from_config(project.commtrack_settings.openlmis_config) sync_supply_point_to_openlmis(supply_point, endpoint, created)
def supply_point_updated(sender, supply_point, created, **kwargs): project = Domain.get_by_name(supply_point.domain) if project.commtrack_enabled and project.commtrack_settings.openlmis_enabled: # check if supply_point is of 'chw type' if supply_point.location and supply_point.location.type is 'chw': #check if supply_point is linked to an OpenLMIS facility if supply_point.location.parent and supply_point.location.parent.external_id: endpoint = OpenLMISEndpoint.from_config(project.commtrack_settings.openlmis_config) sync_supply_point_to_openlmis(supply_point, endpoint)