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

Module: Shipment Advice

Entity: shipment.advice

Compute Method: _compute_line_to_load_ids

Inputs Method Outputs
picking_type_ids = self.env.context.get("shipment_picking_type_ids", [])
for shipment in self:
            domain = shipment._find_move_lines_domain(picking_type_ids)
            # Restrict to lines not loaded
            domain.insert(0, ("shipment_advice_id", "=", False))
            # Find lines to load from partially loaded transfers if the shipment
            # is not planned.
            if not shipment.planned_move_ids:
                all_lines_to_load = self.env["stock.move.line"].search(domain)
                all_pickings = all_lines_to_load.picking_id
                loaded_lines = self.env["stock.move.line"].search(
                    [
                        ("picking_id", "in", all_pickings.ids),
                        ("id", "not in", all_lines_to_load.ids),
                        ("shipment_advice_id", "!=", False),
                    ]
                )
                pickings_partially_loaded = loaded_lines.picking_id
                domain += [("picking_id", "in", pickings_partially_loaded.ids)]
            shipment.line_to_load_ids = self.env["stock.move.line"].search(domain)

Back to entity