Openerp 为opportunity创建序列

Openerp 为opportunity创建序列,openerp,Openerp,我正在使用OpenERP6.1.1 我只想为成为商机的潜在客户创建一个序列,而不是为所有潜在客户创建一个序列 由于Lead和opportunity都是使用同一个表建模的,因此不清楚如何实现这一点。请建议 提前感谢。您可以在对象中添加序列字段。当点击“转换为商机”按钮时 您可以将序列分配给此lead 或者,当您想从opportunity菜单创建opportunity时,您可以覆盖create方法,并在create方法中检查记录的类型,如果类型为'opportunity',则在record中分配序列

我正在使用OpenERP6.1.1

我只想为成为商机的潜在客户创建一个序列,而不是为所有潜在客户创建一个序列

由于Lead和opportunity都是使用同一个表建模的,因此不清楚如何实现这一点。请建议


提前感谢。

您可以在对象中添加序列字段。当点击“转换为商机”按钮时

您可以将序列分配给此lead

或者,当您想从opportunity菜单创建opportunity时,您可以覆盖create方法,并在create方法中检查记录的类型,如果类型为'opportunity',则在record中分配序列


谢谢

您可以在对象中添加序列字段。当点击“转换为商机”按钮时

您可以将序列分配给此lead

或者,当您想从opportunity菜单创建opportunity时,您可以覆盖create方法,并在create方法中检查记录的类型,如果类型为'opportunity',则在record中分配序列


谢谢

我终于成功了

重写convert\u opportunity()是不可能的,因为它可能包含一个ID列表,而我不知道如何将序列传递给它。因此,我不得不覆盖\u convert\u opportunity\u data()方法(尽管不是一个好选择!)


我终于成功了

重写convert\u opportunity()是不可能的,因为它可能包含一个ID列表,而我不知道如何将序列传递给它。因此,我不得不覆盖\u convert\u opportunity\u data()方法(尽管不是一个好选择!)


我想我必须重写convert_opportunity()方法,但我不清楚如何传递序列字段的下一个值,以便正确更新它。任何建议。谢谢。您可以在ir.sqence中为crm.lead创建序列,并使用seq=self.pool.get('ir.sequence').get(cr,uid,'crm.lead')访问它,因此当单击按钮“convert to OpperUnity”时,请使用此代码,我想我必须重写convert_opportunity()方法,但我不清楚如何传递序列字段的下一个值,以便正确更新。任何建议。谢谢。您可以在ir.sqence中为crm.lead创建序列,并使用seq=self.pool.get('ir.sequence').get(cr,uid,'crm.lead')访问它,因此当单击按钮“转换为机会”时,请使用此代码
def create(self, cr, uid, vals, context={}):
    if vals['type']=='opportunity':
        next_seq = self.pool.get('ir.sequence').get(cr, uid, 'crm.lead')
        vals['seq'] = next_seq
    res = super(crm_sequence, self).create(cr, uid, vals, context)
    return res

def _convert_opportunity_data(self, cr, uid, lead, customer, section_id=False, context=None):
    vals = super(crm_sequence, self)._convert_opportunity_data(cr, uid, lead, customer, section_id, context)
    next_eq = self.pool.get('ir.sequence').get(cr, uid, 'crm.lead')
    vals['seq'] = next_seq
    return vals