电话呼叫改变机会,改变机会日期行动

2024-06-01 08:19:13 发布

您现在位置:Python中文网/ 问答频道 /正文

我们有机会改变的方法crm.phonecall.py. 我想知道(并试图)如果你给一个预定的电话添加了一个机会,那么这个机会的行动日期(下一个行动日期)就会变成预定的电话日期。你知道吗

def on_change_opportunity(self, cr, uid, ids, opportunity_id, context=None):
    values = {}
    if opportunity_id:
        opportunity = self.pool.get('crm.lead').browse(cr, uid, opportunity_id, context=context)
        values = {
            'section_id' : opportunity.section_id and opportunity.section_id.id or False,
            'partner_phone' : opportunity.phone,
            'partner_mobile' : opportunity.mobile,
            'partner_id' : opportunity.partner_id and opportunity.partner_id.id or False,
        }
    return {'value' : values}

我试着添加一行: opportunity.date_action = self.date.strftime('%Y-%m-%d') 这显然不管用。如何进行?你知道吗

编辑。我得到的错误是AttributeError: 'crm.phonecall' object has no attribute '_ids'


Tags: andselfididspartneruidcontextsection
1条回答
网友
1楼 · 发布于 2024-06-01 08:19:13
def on_change_opportunity(self, cr, uid, ids, opportunity_id, context=None):
values = {}
if opportunity_id:
    opportunity = self.pool.get('crm.lead').browse(cr, uid, opportunity_id, context=context)
    values = {
        'section_id' : opportunity.section_id and opportunity.section_id.id or False,
        'partner_phone' : opportunity.phone,
        'partner_mobile' : opportunity.mobile,
        'partner_id' : opportunity.partner_id and opportunity.partner_id.id or False,
    }

    phonecall = self.browse(cr, uid, ids, context=context)
    if phonecall:
        date = phonecall[0].date
        opportunity.write({'date_action': date})

return {'value' : values}

相关问题 更多 >