diff --git a/base_custom_info/models/custom_info.py b/base_custom_info/models/custom_info.py index 0f42174a8..cfb06c81d 100644 --- a/base_custom_info/models/custom_info.py +++ b/base_custom_info/models/custom_info.py @@ -55,7 +55,7 @@ class CustomInfoValue(models.Model): "Another property with that name exists for that resource."), ] - model = fields.Char(index=True, required=True) + model_id = fields.Many2one("ir.model", "Model", required=True) res_id = fields.Integer("Resource ID", index=True, required=True) property_id = fields.Many2one( comodel_name='custom.info.property', @@ -75,7 +75,8 @@ class CustomInfo(models.AbstractModel): custom_info_ids = fields.One2many( comodel_name='custom.info.value', inverse_name='res_id', - domain=lambda self: [('model', '=', self._name)], + domain=lambda self: self.env["ir.model"].search( + [("model_id", "=", self._name)]).id, auto_join=True, string='Custom Properties') diff --git a/base_custom_info/views/custom_info_value_view.xml b/base_custom_info/views/custom_info_value_view.xml index c7a5379c5..2c3c6f8a3 100644 --- a/base_custom_info/views/custom_info_value_view.xml +++ b/base_custom_info/views/custom_info_value_view.xml @@ -9,7 +9,7 @@ - +