如何在odoo 8中覆盖name_get方法

时间:2018-12-26 11:05:47

标签: python odoo

我正在尝试覆盖crm.lead模型中的name_get方法,但未调用。

我尝试使用旧的api

def name_get(self, cr, uid, ids, context=None):
    if not ids:
         return []
    result = []
    for lead in self.browse(cr, uid, ids, context=context):
        result.append((partner.id, lead.name + ' [' + lead.sequence + ']'))
return result

并使用新的API

@api.multi
def name_get(self):
    res = super(crm_lead, self).name_get()
    data = []
    for record in self:
        name = record.name
        sequence = record.sequence
        data.append((record.id, record.name + ' [' + record.sequence + ']'))
    return data

我检查了是否有其他模块替代了此方法 谢谢

0 个答案:

没有答案