addons-cm/stock_picking_batch_collect/migrations/18.0.2.1.0/post-migration.py
GitHub Copilot 9c81cb986d
[IMP] stock_picking_batch_collect: collected checks on transfers, ordered quantity, delivery slips report
- The collected checks also apply to transfers outside a batch, opt-in per
  operation type ("Require Collected Lines"), with the batch restrictions of
  the settings. A per-product toggle in the transfer's Operations tab collects
  all its lines.
- Read-only ordered quantity from the sale line on every batch and transfer
  view, since the weighed demand overwrites it. Adds a dependency on
  sale_stock; a migration fills it in the summary of open batches.
- "Delivery Slips" report on the batch: all its delivery slips in one PDF.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 14:34:06 +02:00

15 lines
543 B
Python

# 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"])