'Parses the context and returns a list of location_ids based on it.
It will return all stock locations when no parameters are given
Possible parameters are shop, warehouse, location, force_company, compute_child'

def _get_domain_locations(self):

    Warehouse = self.env['stock.warehouse']
    location_ids = []
    if self.env.context.get('location', False):
        if isinstance(self.env.context['location'], (int, long)):
            location_ids = [self.env.context['location']]
        elif isinstance(self.env.context['location'], basestring):
            domain = [('complete_name', 'ilike', self.env.context['location'])]
            if self.env.context.get('force_company', False):
                domain += [('company_id', '=', self.env.context['force_company'])]
            location_ids = self.env['stock.location'].search(domain).ids
        else:
            location_ids = self.env.context['location']
    else:
        if self.env.context.get('warehouse', False):
            if isinstance(self.env.context['warehouse'], (int, long)):
                wids = [self.env.context['warehouse']]
            elif isinstance(self.env.context['warehouse'], basestring):
                domain = [('name', 'ilike', self.env.context['warehouse'])]
                if self.env.context.get('force_company', False):
                    domain += [('company_id', '=', self.env.context['force_company'])]
                wids = Warehouse.search(domain).ids
            else:
                wids = self.env.context['warehouse']
        else:
            wids = Warehouse.search([]).ids
        for w in Warehouse.browse(wids):
            location_ids.append(w.view_location_id.id)
    return self._get_domain_locations_new(location_ids, company_id=self.env.context.get('force_company', False), compute_child=self.env.context.get('compute_child', True))
