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

Module: Weighing assistant

Entity: stock.move

Compute Method: _compute_weighing_state

Inputs Method Outputs
"""Only products with weight will trigger this state"""
self.weighing_state = False
for move in self.filtered("has_weight"):
            move_to_do = move.state not in {"draft", "cancel", "done"}
            if (
                move.move_lines_weighed
                # Force the operation weighing state if one of the detailed
                # operations overpasses the demand
                or float_compare(
                    move.quantity,
                    move.product_uom_qty,
                    precision_rounding=move.product_uom.rounding,
                )
                >= 0
            ) and any(move.move_line_ids.mapped("has_recorded_weight")):
                move.weighing_state = "weighed"
            elif move.recorded_weight and not move.move_lines_weighed and move_to_do:
                move.weighing_state = "weighing"
            elif (
                not move.recorded_weight
                and not move.move_lines_weighed
                and move_to_do
                and not move.qty_picked
            ):
                move.weighing_state = "to_weigh"

Back to entity