我有Many2one字段,它使用自定义域由res.partner模块填充。
当用户从Many2one字段中选择一个值时,我希望根据选定的值隐藏一些字段。
我试试看:
<group string="My group name" attrs="{'invisible': [('mym2ofield', 'not ilike', 'mym2ofield value')]}">但不起作用。我怎样才能做到呢?
发布于 2015-08-04 07:11:26
首先,我们需要在您的模型中添加相关字段。而不是在attrs中使用这个新的相关字段
例如:
type是many2one表上的char字段。
class model_name(models.Model):
_name = 'model.name'
test_id = fields.Many2one('relation.table.name', string="Many2One Label")
type = fields.Char(related='test_id.type', string="Type")然后到你的表格上:
<group string="group name" attrs="{'invisible': [('type', '!=', 'value')]}">https://stackoverflow.com/questions/31802484
复制相似问题