[FIX] base: allow to remove default properties when uninstalling module
Uninstalling a module shouldn't be blocked by properties using the record. Instead, we are removing the property. Part-of: odoo/odoo#110016
This commit is contained in:
+4
-1
@@ -3518,8 +3518,11 @@ class BaseModel(metaclass=MetaModel):
|
||||
|
||||
# Check if the records are used as default properties.
|
||||
refs = [f'{self._name},{id_}' for id_ in sub_ids]
|
||||
if Property.search([('res_id', '=', False), ('value_reference', 'in', refs)], limit=1):
|
||||
default_properties = Property.search([('res_id', '=', False), ('value_reference', 'in', refs)])
|
||||
if not self._context.get(MODULE_UNINSTALL_FLAG) and default_properties:
|
||||
raise UserError(_('Unable to delete this document because it is used as a default property'))
|
||||
else:
|
||||
ir_property_unlink |= default_properties
|
||||
|
||||
# Delete the records' properties.
|
||||
ir_property_unlink |= Property.search([('res_id', 'in', refs)])
|
||||
|
||||
Reference in New Issue
Block a user