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

Module: Stock Demand Estimate

Entity: stock.demand.estimate

Compute Method: _compute_dates

Inputs Method Outputs
today = date.today()
for rec in self:
            rec.date_from = rec.manual_date_from or today
            if rec.manual_date_to:
                rec.date_to = rec.manual_date_to
                rec.duration = (rec.manual_date_to - rec.date_from).days + 1
            elif rec.manual_duration:
                rec.date_to = rec.date_from + timedelta(days=rec.manual_duration - 1)
                rec.duration = rec.manual_duration
            else:
                rec.date_to = rec.date_from + timedelta(days=1)
                rec.duration = 2

Back to entity