(self, location_id, fall_back_to_next=False)
Unset a location that the user is assigned to that may or may not be primary location.
            If the location_id is primary-location, then next available location from
            assigned_location_ids is set as the primary-location.
            If fall_back_to_next is True, primary location is not set to next
Unset a location that the user is assigned to that may or may not be primary location.
            If the location_id is primary-location, then next available location from
            assigned_location_ids is set as the primary-location.
            If fall_back_to_next is True, primary location is not set to next
Unset a location that the user is assigned to that may or may not be primary location . If the location_id is primary - location then next available location from assigned_location_ids is set as the primary - location . If fall_back_to_next is True primary location is not set to next
def unset_location_by_id(self, location_id, fall_back_to_next=False):
        """
        Unset a location that the user is assigned to that may or may not be primary location.
            If the location_id is primary-location, then next available location from
            assigned_location_ids is set as the primary-location.
            If fall_back_to_next is True, primary location is not set to next
        """
        if location_id == self.location_id:
            # check if primary location
            self.unset_location(fall_back_to_next)
        else:
            self._remove_location_from_user(location_id)

            if self.assigned_location_ids:
                self.update_metadata({'commcare_location_ids': user_location_data(self.assigned_location_ids)})
            else:
                self.pop_metadata('commcare_location_ids')
            self.save()
def unset_location_by_id ( self , location_id , fall_back_to_next = False ) : if location_id == self . location_id : # check if primary location self . unset_location ( fall_back_to_next ) else : self . _remove_location_from_user ( location_id ) if self . assigned_location_ids : self . update_metadata ( { 'commcare_location_ids' : user_location_data ( self . assigned_location_ids ) } ) else : self . pop_metadata ( 'commcare_location_ids' ) self . save ( )