OdooMindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.
for lot in self:
quants = lot.quant_ids.filtered(lambda q: q.quantity > 0)
lot.location_id = quants.location_id if len(quants.location_id) == 1 else False