With the old api we could return a domain in the on change function, is this possible with the new api?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- 客户关系管理
- e-Commerce
- 会计
- 库存
- PoS
- Project
- MRP
此问题已终结
ok, its possible, but if the function has the decorator @api.one not works.
my error:
@api.one
@api.onchange('field_id')
def onchange_field_id(self):
relation_ids = [x.id for x in self.field_id.relation_ids]
return {'domain':{'relation_id': [('id', 'in', relation_ids)]}}
but without @api.one works perfectly
@api.onchange('field_id')
def onchange_field_id(self):
relation_ids = [x.id for x in self.field_id.relation_ids]
return {'domain':{'relation_id': [('id', 'in', relation_ids)]}}
Short update that it still works for V14/V15. Simply remove the @api.one there as this has been deprecated :-)
@Yenthe onchange that returns a domain is deprecated..
Yes, Its possible an onchange method can return three items (warning, domain, value)
You can also use @api.multi
相关帖文 | 回复 | 查看 | 活动 | |
---|---|---|---|---|
|
1
1月 17
|
6637 | ||
|
1
8月 25
|
292 | ||
|
1
8月 25
|
333 | ||
|
4
7月 25
|
1680 | ||
|
1
7月 25
|
957 |