美好的一天!我有我想对这里的其他选择框中选择的数据填充选择框的基础的问题是我的代码基于其他选择框的选择框的人口
的.py
licensetype = fields.Many2one('hr.licensetype','License Type')
license = fields.Many2one('hr.license','License')
@api.one
@api.onchange('licensetype')
def getlicense(self):
if len(self.licensetype) > 0:
mdlLicense= self.env['hr.license'].search([('license_name', '=', int(self.licensetype[0]))])
#raise Warning(mdlLicense.ids)
self.license = mdlLicense.ids
但仍填充所有许可我想填充基于所选许可证类型的许可证。这是在Odoo8
license_name是整数fileds? –
这是什么意思'如果len(self.licensetype)> 0:'?难道你不想只写'如果self.licensetype:'而不是? – forvas
请先清除搜索条件。是license_name是整型。?也分享你想要搜索的搜索条件。 hr.licensetype和hr.license之间的关系是什么? –