美文网首页pythonodoo
odoo many2one的context

odoo many2one的context

作者: 隔壁小红馆 | 来源:发表于2020-06-16 17:35 被阅读0次
    def _domain_compute(self):
        print(self.env.context.get('default_exchange'))
        if self.env.context.get('default_exchange'):
            return [('related_processes', '=', self.env.context.get('default_exchange'))]

    type = fields.Many2one('quality.setting', string="质检类型", domain=_domain_compute)

在各自的作业中筛选不同的质检类型,因其在表 ‘quality.setting’中有related_processes 的selection字段,故用
self.env.context.get来传值,取到相对应的数据。


记录

制作不易,点赞鼓励哈

相关文章

网友评论

    本文标题:odoo many2one的context

    本文链接:https://www.haomeiwen.com/subject/hsmrxktx.html