Impacted versions: 11.0-20180115

Steps to reproduce: Setup Odoo database with demo data loaded. And remove the `Purchase Management` and/or `Inventory Management` App. And try to install it again.

Current behavior: Installation is not possible anymore (crashes).

Inventory Management App gives:
```log
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 741, in parse
    self._tags[rec.tag](rec, de, mode=mode)
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 651, in _tag_record
    id = self.env(context=rec_context)['ir.model.data']._update(rec_model, self.module, res, rec_id or False, not self.isnoupdate(data_node), noupdate=self.isnoupdate(data_node), mode=self.mode)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/ir/ir_model.py", line 1469, in _update
    record = record.create(values)
  File "/usr/lib/python3/dist-packages/odoo/models.py", line 3278, in create
    record = self.browse(self._create(old_vals))
  File "/usr/lib/python3/dist-packages/odoo/models.py", line 3371, in _create
    cr.execute(query, tuple(u[2] for u in updates if len(u) > 2))
  File "/usr/lib/python3/dist-packages/odoo/sql_db.py", line 155, in wrapper
    return f(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/sql_db.py", line 232, in execute
    res = self._obj.execute(query, params)
psycopg2.IntegrityError: null value in column "location_id" violates not-null constraint
DETAIL:  Failing row contains (4, OP/00001, t, 3, null, 5, 5.000, 10.000, 1.000, null, 1, 1, supplier, 1, 2018-01-15 16:28:33.469686, 1, 2018-01-15 16:28:33.469686).


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 646, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 307, in _handle_exception
    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
  File "/usr/lib/python3/dist-packages/odoo/tools/pycompat.py", line 87, in reraise
    raise value
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 683, in dispatch
    result = self._call_function(**self.params)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 339, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 97, in wrapper
    return f(dbname, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 332, in checked_call
    result = self.endpoint(*a, **kw)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 927, in __call__
    return self.method(*args, **kw)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 512, in response_wrap
    response = f(*args, **kw)
  File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 934, in call_button
    action = self._call_kw(model, method, args, {})
  File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 922, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/usr/lib/python3/dist-packages/odoo/api.py", line 689, in call_kw
    return call_kw_multi(method, model, args, kwargs)
  File "/usr/lib/python3/dist-packages/odoo/api.py", line 680, in call_kw_multi
    result = method(recs, *args, **kwargs)
  File "<decorator-gen-39>", line 2, in button_immediate_install
  File "/usr/lib/python3/dist-packages/odoo/addons/base/module/module.py", line 71, in check_and_log
    return method(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/module/module.py", line 448, in button_immediate_install
    return self._button_immediate_function(type(self).button_install)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/module/module.py", line 541, in _button_immediate_function
    modules.registry.Registry.new(self._cr.dbname, update_module=True)
  File "/usr/lib/python3/dist-packages/odoo/modules/registry.py", line 85, in new
    odoo.modules.load_modules(registry._db, force_demo, status, update_module)
  File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 343, in load_modules
    loaded_modules, update_module)
  File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 242, in load_marked_modules
    loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
  File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 159, in load_module_graph
    _load_data(cr, module_name, idref, mode, kind='demo')
  File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 94, in _load_data
    tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report)
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 788, in convert_file
    convert_xml_import(cr, module, fp, idref, mode, noupdate, report)
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 849, in convert_xml_import
    obj.parse(doc.getroot(), mode=mode)
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 738, in parse
    self.parse(rec, mode)
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 748, in parse
    exc_info[2]
  File "/usr/lib/python3/dist-packages/odoo/tools/pycompat.py", line 86, in reraise
    raise value.with_traceback(tb)
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 741, in parse
    self._tags[rec.tag](rec, de, mode=mode)
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 651, in _tag_record
    id = self.env(context=rec_context)['ir.model.data']._update(rec_model, self.module, res, rec_id or False, not self.isnoupdate(data_node), noupdate=self.isnoupdate(data_node), mode=self.mode)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/ir/ir_model.py", line 1469, in _update
    record = record.create(values)
  File "/usr/lib/python3/dist-packages/odoo/models.py", line 3278, in create
    record = self.browse(self._create(old_vals))
  File "/usr/lib/python3/dist-packages/odoo/models.py", line 3371, in _create
    cr.execute(query, tuple(u[2] for u in updates if len(u) > 2))
  File "/usr/lib/python3/dist-packages/odoo/sql_db.py", line 155, in wrapper
    return f(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/sql_db.py", line 232, in execute
    res = self._obj.execute(query, params)
odoo.tools.convert.ParseError: "null value in column "location_id" violates not-null constraint
DETAIL:  Failing row contains (4, OP/00001, t, 3, null, 5, 5.000, 10.000, 1.000, null, 1, 1, supplier, 1, 2018-01-15 16:28:33.469686, 1, 2018-01-15 16:28:33.469686).
" while parsing /usr/lib/python3/dist-packages/odoo/addons/stock/data/stock_orderpoint_demo.xml:6, near
<record id="stock_warehouse_orderpoint_1" model="stock.warehouse.orderpoint">
            <field name="product_max_qty">10.0</field>
            <field name="product_min_qty">5.0</field>
            <field name="product_uom" ref="product.product_uom_unit"/>
            <field model="stock.warehouse" name="warehouse_id" search="[]"/>
            <field name="product_id" ref="product.product_delivery_02"/>
            <!-- <field name="location_id" ref="stock.stock_location_stock"/> -->
        </record>
````

Purchase Management App I get:
```log
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/tools/yaml_import.py", line 147, in get_id
    id = self.env.ref(full_xml_id).id
  File "/usr/lib/python3/dist-packages/odoo/api.py", line 793, in ref
    return self['ir.model.data'].xmlid_to_object(xml_id, raise_if_not_found=raise_if_not_found)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/ir/ir_model.py", line 1340, in xmlid_to_object
    raise ValueError('No record found for unique ID %s. It may have been deleted.' % (xmlid))
ValueError: No record found for unique ID stock.stock_location_shop0. It may have been deleted.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 646, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 307, in _handle_exception
    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
  File "/usr/lib/python3/dist-packages/odoo/tools/pycompat.py", line 87, in reraise
    raise value
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 683, in dispatch
    result = self._call_function(**self.params)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 339, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 97, in wrapper
    return f(dbname, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 332, in checked_call
    result = self.endpoint(*a, **kw)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 927, in __call__
    return self.method(*args, **kw)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 512, in response_wrap
    response = f(*args, **kw)
  File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 934, in call_button
    action = self._call_kw(model, method, args, {})
  File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 922, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/usr/lib/python3/dist-packages/odoo/api.py", line 689, in call_kw
    return call_kw_multi(method, model, args, kwargs)
  File "/usr/lib/python3/dist-packages/odoo/api.py", line 680, in call_kw_multi
    result = method(recs, *args, **kwargs)
  File "<decorator-gen-39>", line 2, in button_immediate_install
  File "/usr/lib/python3/dist-packages/odoo/addons/base/module/module.py", line 71, in check_and_log
    return method(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/module/module.py", line 448, in button_immediate_install
    return self._button_immediate_function(type(self).button_install)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/module/module.py", line 541, in _button_immediate_function
    modules.registry.Registry.new(self._cr.dbname, update_module=True)
  File "/usr/lib/python3/dist-packages/odoo/modules/registry.py", line 85, in new
    odoo.modules.load_modules(registry._db, force_demo, status, update_module)
  File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 343, in load_modules
    loaded_modules, update_module)
  File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 242, in load_marked_modules
    loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
  File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 159, in load_module_graph
    _load_data(cr, module_name, idref, mode, kind='demo')
  File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 94, in _load_data
    tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report)
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 786, in convert_file
    convert_yaml_import(cr, module, fp, kind, idref, mode, noupdate, report)
  File "/usr/lib/python3/dist-packages/odoo/tools/yaml_import.py", line 854, in yaml_import
    yaml_interpreter.process(yaml_string)
  File "/usr/lib/python3/dist-packages/odoo/tools/yaml_import.py", line 797, in process
    self._process_node(node)
  File "/usr/lib/python3/dist-packages/odoo/tools/yaml_import.py", line 808, in _process_node
    self.process_record(node)
  File "/usr/lib/python3/dist-packages/odoo/tools/yaml_import.py", line 314, in process_record
    record_dict = self._create_record(model, fields, view_info, default=default, context=context)
  File "/usr/lib/python3/dist-packages/odoo/tools/yaml_import.py", line 463, in _create_record
    field_value = self._eval_field(model, field_name, fields[field_name], form_view, parent=record_dict, default=default, context=ctx)
  File "/usr/lib/python3/dist-packages/odoo/tools/yaml_import.py", line 543, in _eval_field
    value = self.get_id(expression)
  File "/usr/lib/python3/dist-packages/odoo/tools/yaml_import.py", line 152, in get_id
    tests that belong to a module's test suite and depend on each other.""" % (xml_id, self.filename))
ValueError: 'stock.stock_location_shop0' not found when processing /usr/lib/python3/dist-packages/odoo/addons/stock/data/stock_demo.yml.
    This Yaml file appears to depend on missing data. This often happens for
    tests that belong to a module's test suite and depend on each other.
```

Expected behavior: Installation of **any** Odoo App should always work (also with demo data).


addons/stock/__manifest__.py
{
    'name': 'Inventory Management',
    'version': '1.1',