如何在odoo 9中创建选择字段
我想选择并显示不同的字段 例: 我选择test1显示字段1、test2显示字段2和Test3显示字段3 这是我的课如何在odoo 9中创建选择字段,odoo,xml-rpc,odoo-9,Odoo,Xml Rpc,Odoo 9,我想选择并显示不同的字段 例: 我选择test1显示字段1、test2显示字段2和Test3显示字段3 这是我的课 class topo_log(models.Model): _name = 'topo.log' selection_type = fields.Selection(string='Selection Type', selection=[('test1','Test 1'), ('test2','Test 2'), ('test3','Test 3')]) testfield1
class topo_log(models.Model):
_name = 'topo.log'
selection_type = fields.Selection(string='Selection Type', selection=[('test1','Test 1'), ('test2','Test 2'), ('test3','Test 3')])
testfield1 = fields.Many2one('test.model1',string='Test 1', select=True)
testfield2 = fields.Many2one('test.model2',string='Test 2', select=True)
testfield3 = fields.Many2one('test.model3',string='Test 3', select=True)
这是我的xml
<field name="selection_type" />
<field name="testfield1" attrs="{'invisible':[('selection_type','==','test2','test3')]}" />
<field name="testfield2" attrs="{'invisible':[('selection_type','==','test1','test3')]}" />
<field name="testfield3" attrs="{'invisible':[('selection_type','==','test1','test2')]}" />
但是,我的代码不起作用。有人能帮我写代码吗?像这样更改你的过滤域
<field name="testfield1" attrs="{'invisible':[('selection_type','in',['test2','test3'])]}" />