Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: CRM

Entity: crm.lead

Compute Method: _compute_day_open

Inputs Method Outputs
""" Compute difference between create date and open date """
leads = self.filtered(lambda l: l.date_open and l.create_date)
others = self - leads
others.day_open = None
for lead in leads:
            date_create = fields.Datetime.from_string(lead.create_date).replace(microsecond=0)
            date_open = fields.Datetime.from_string(lead.date_open)
            lead.day_open = abs((date_open - date_create).days)

Back to entity