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

Module: Remote Measure Devices Input on Stock

Entity: stock.move.line

Compute Method: _compute_remote_scale_id

Inputs Method Outputs
  • picking_id
  • picking_id.remote_scale_id
  • picking_id.picking_type_id
  • picking_id.picking_type_id.remote_scale_id
  • product_uom_id
  • product_uom_id.category_id
"""We don't want to measure if the scale uom is not in the same category than
        the line"""
for sml in self:
            picking_scale = (
                sml.picking_id.remote_scale_id
                or sml.picking_id.picking_type_id.remote_scale_id
            )
            scale = (
                sml.product_uom_id.category_id == picking_scale.uom_id.category_id
                and picking_scale
            )
            if not scale and self.env.context.get("force_user_measure_device"):
                scale = (
                    sml.product_uom_id.category_id
                    == self.env.user.remote_measure_device_id.uom_id.category_id
                    and self.env.user.remote_measure_device_id
                )
            sml.remote_scale_id = scale or False

Back to entity