Browse Source

Move model to model_id.

pull/435/head
Jairo Llopis 9 years ago
parent
commit
8699ee70e0
  1. 5
      base_custom_info/models/custom_info.py
  2. 2
      base_custom_info/views/custom_info_value_view.xml

5
base_custom_info/models/custom_info.py

@ -55,7 +55,7 @@ class CustomInfoValue(models.Model):
"Another property with that name exists for that resource."), "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) res_id = fields.Integer("Resource ID", index=True, required=True)
property_id = fields.Many2one( property_id = fields.Many2one(
comodel_name='custom.info.property', comodel_name='custom.info.property',
@ -75,7 +75,8 @@ class CustomInfo(models.AbstractModel):
custom_info_ids = fields.One2many( custom_info_ids = fields.One2many(
comodel_name='custom.info.value', comodel_name='custom.info.value',
inverse_name='res_id', 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, auto_join=True,
string='Custom Properties') string='Custom Properties')

2
base_custom_info/views/custom_info_value_view.xml

@ -9,7 +9,7 @@
<tree string="Custom Property Values"> <tree string="Custom Property Values">
<field name="property_id"/> <field name="property_id"/>
<field name="value"/> <field name="value"/>
<field name="model"/>
<field name="model_id"/>
<field name="res_id"/> <field name="res_id"/>
</tree> </tree>
</field> </field>

Loading…
Cancel
Save