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

Module: DDMRP

Entity: stock.buffer

Compute Method: _compute_distributed_source_location_qty

Inputs Method Outputs
to_compute_per_location = {}
for record in self:
            location = record.distributed_source_location_id
            if not location:
                record.distributed_source_location_qty = 0.0
                continue
            to_compute_per_location.setdefault(location.id, set())
            to_compute_per_location[location.id].add(record.id)
for location_id, buffer_ids in to_compute_per_location.items():
            buffers = self.browse(buffer_ids).with_context(location=location_id)
            for buf in buffers:
                buf.distributed_source_location_qty = buf.product_id.free_qty

Back to entity