Impacted versions: 11c, 11e

Steps to reproduce: Install module, uninstall it, then go to action choise delete module (tested with some module: Automated Translations through Gengo API, Vietnam - Accounting...)

Current behavior:
Popup error:
```
The operation cannot be completed, probably due to the following:
- deletion: you may be trying to delete a record while other records still reference it
- creation/update: a mandatory field is not correctly set

[object with reference: Module Uninstallation - base.module.uninstall]
```
--
logs:
```
ERROR: null value in column "module_id" violates not-null constraint
DETAIL:  Failing row contains (1, t, null, 1, 2017-11-06 09:26:04.803957, 1, 2017-11-06 09:26:04.803957).
CONTEXT:  SQL statement "UPDATE ONLY "public"."base_module_uninstall" SET "module_id" = NULL WHERE $1 OPERATOR(pg_catalog.=) "module_id""
```

If module is not installed before, no error occurs

Expected behavior: the module should delete normally
if level < 1:
            raise UserError(_('Recursion error in modules dependencies !'))
        
        demo = False
        for module in self:
            
            update_mods, ready_mods = self.browse(), self.browse()
            for dep in module.dependencies_id:
                if dep.state == 'unknown':
                    raise UserError(_("You try to install module '%s' that depends on module '%s'.\nBut the latter module is not available in your system.") % (module.name, dep.name,))
                if dep.depend_id.state == newstate:
                    ready_mods += dep.depend_id
                else:
                    update_mods += dep.depend_id
            
            update_demo = update_mods._state_update(newstate, states_to_update, level=level-1)
            module_demo = module.demo or update_demo or any(mod.demo for mod in ready_mods)
            demo = demo or module_demo
            
            self.check_external_dependencies(module.name, newstate)
            if module.state in states_to_update:
                module.write({'state': newstate, 'demo': module_demo})