|
|
"""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"
|
|