# Copyright 2026 Criptomart # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo import SUPERUSER_ID from odoo import api def migrate(cr, version): """Fill the new ordered quantity of the open batches' product summary.""" env = api.Environment(cr, SUPERUSER_ID, {}) batches = env["stock.picking.batch"].search( [("state", "in", ("draft", "in_progress"))] ) env.add_to_compute(env["stock.picking.batch"]._fields["summary_line_ids"], batches) batches.flush_recordset(["summary_line_ids"])