附加列表项出现2次

时间:2016-04-19 13:48:23

标签: python openerp

当我尝试此代码时,操作模块将作为原始“审计”审计模块: 在audit.py中:

 class action(orm.Model):
 _inherit = "action"
 def __init__(self, pool, cr):
    """Add a new audit value"""
    return super(action, self).Origin_SELECTION.append(('audit', 'Audit'))

在action.py中我们有:

Origin_SELECTION=[('dysfunction','Dysfunction')]
origin_act = fields.Selection(Origin_SELECTION, 'Origin')

在最终选择字段中,'审核'选项出现了2次。

2 个答案:

答案 0 :(得分:0)

尝试:

class my_model(orm.Model):     _inherit ='my.model'

def _type_selection(self, cr, uid, context=None):
    selection = super(my_model, self)._type_selection(cr, uid, context=context)
    selection.append(('special', 'Special'))
    return selection

答案 1 :(得分:0)