[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>
This commit is contained in:
GitHub Copilot 2026-10-04 14:32:38 +02:00
parent 76dc355c6c
commit 9c81cb986d
Signed by: snt
GPG key ID: A9FD34930EADBE71
24 changed files with 630 additions and 39 deletions

View file

@ -0,0 +1 @@
from . import report_batch_deliveryslip # noqa: F401

View file

@ -0,0 +1,25 @@
# Copyright 2026 Criptomart
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api
from odoo import models
class ReportBatchDeliverySlip(models.AbstractModel):
_name = "report.stock_picking_batch_collect.report_batch_deliveryslip"
_description = "Batch Delivery Slips"
@api.model
def _get_report_values(self, docids, data=None):
batches = self.env["stock.picking.batch"].browse(docids)
pickings = self.env["stock.picking"]
for batch in batches:
pickings |= batch.picking_ids.filtered(
lambda picking: picking.state != "cancel"
).sorted(lambda picking: (picking.partner_id.name or "", picking.name))
return {
"doc_ids": docids,
"doc_model": "stock.picking.batch",
"docs": batches,
"pickings": pickings,
}

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="action_report_batch_deliveryslip" model="ir.actions.report">
<field name="name">Delivery Slips</field>
<field name="model">stock.picking.batch</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">stock_picking_batch_collect.report_batch_deliveryslip</field>
<field name="report_file">stock_picking_batch_collect.report_batch_deliveryslip</field>
<field name="print_report_name">'Delivery Slips - %s' % object.name</field>
<field name="binding_model_id" ref="stock_picking_batch.model_stock_picking_batch"/>
<field name="binding_type">report</field>
</record>
<template id="report_batch_deliveryslip">
<t t-foreach="pickings" t-as="o">
<t t-call="stock.report_delivery_document" t-lang="o._get_report_lang()"/>
</t>
</template>
</odoo>