在fields.Reference上添加域

时间:2017-12-13 09:59:58

标签: python openerp

我想在fields.Reference上添加域名。

class CategoryWizard(models.TransientModel):
    _name = 'category.wizard'

    _description = 'Category Tree Manipulation'

    tree1_type = fields.Reference(selection=[('product.public.category', 'Website Category Tree'), ('product.category', 'Internal Category Tree')],
                                  string="First Tree", domain="['parent_id', '=', False]")

    tree2_type = fields.Reference(selection=[('product.public.category', 'WebSite Category Tree'), ('product.category', 'Internal Category Tree')],
                                  string="Second Tree")

在我的示例中,我只想在选择模型后显示带有domain="['parent_id', '=', False]")的类别树头

1 个答案:

答案 0 :(得分:0)

在odoo域中是元组列表,每个元组都有3个元素(field_name, operator, value)

     domain="[('parent_id', '=', False)]"