[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

@ -9,6 +9,7 @@
<field name="product_id" readonly="1" context="{'display_default_code': False}"/>
<field name="product_default_code" readonly="1" optional="hide"/>
<field name="product_uom_id" readonly="1" optional="hide"/>
<field name="qty_ordered" readonly="1" optional="show"/>
<field name="qty_demanded" readonly="1"/>
<field name="qty_done" readonly="1"/>
<field name="qty_pending" readonly="1"/>
@ -30,6 +31,7 @@
context="{'display_default_code': False}"/>
<field name="reference" readonly="1" optional="hide"/>
<field name="picking_partner_id" readonly="1" optional="show"/>
<field name="sale_ordered_qty" string="Ordered" readonly="1" optional="show"/>
<field name="quantity" string="Cant."/>
<!-- Loaded so `_onchange_quantity_manual` reaches the server. -->
<field name="picked" column_invisible="True"/>
@ -78,6 +80,9 @@
<field name="product_default_code" readonly="1" optional="hide"/>
<field name="is_collected" widget="boolean_toggle" optional="show"/>
</xpath>
<xpath expr="//field[@name='quantity']" position="before">
<field name="sale_ordered_qty" readonly="1" optional="show"/>
</xpath>
<xpath expr="//field[@name='quantity']" position="after">
<!-- Loaded so `_onchange_quantity_manual` reaches the server. -->
<field name="picked" column_invisible="True"/>
@ -100,4 +105,15 @@
</field>
</record>
<record id="view_picking_move_tree_inherit_batch_collect" model="ir.ui.view">
<field name="name">stock_picking_batch.picking.move.list.collect</field>
<field name="model">stock.move</field>
<field name="inherit_id" ref="stock_picking_batch.view_picking_move_tree_inherited"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='product_uom_qty']" position="before">
<field name="sale_ordered_qty" readonly="1" optional="show"/>
</xpath>
</field>
</record>
</odoo>

View file

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_picking_form_inherit_collect" model="ir.ui.view">
<field name="name">stock.picking.form.collect</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='move_ids_without_package']/list/field[@name='product_uom_qty']" position="before">
<field name="sale_ordered_qty" readonly="1" optional="show"
column_invisible="parent.picking_type_code != 'outgoing'"/>
</xpath>
<xpath expr="//field[@name='move_ids_without_package']/list/field[@name='quantity']" position="after">
<field name="is_collected" widget="boolean_toggle" optional="show"
column_invisible="parent.state == 'draft'"
readonly="not move_line_ids or state in ('done', 'cancel')"/>
</xpath>
</field>
</record>
<record id="view_stock_move_line_detailed_operation_tree_inherit_collect" model="ir.ui.view">
<field name="name">stock.move.line.operations.list.collect</field>
<field name="model">stock.move.line</field>
<field name="inherit_id" ref="stock.view_stock_move_line_detailed_operation_tree"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='quantity']" position="before">
<field name="sale_ordered_qty" readonly="1" optional="show"
column_invisible="context.get('picking_code') == 'incoming'"/>
</xpath>
<xpath expr="//field[@name='quantity']" position="after">
<field name="is_collected" widget="boolean_toggle" optional="show"
readonly="state in ('done', 'cancel')"/>
</xpath>
</field>
</record>
<record id="view_stock_move_line_operation_tree_inherit_collect" model="ir.ui.view">
<field name="name">stock.move.line.operations.list.popup.collect</field>
<field name="model">stock.move.line</field>
<field name="inherit_id" ref="stock.view_stock_move_line_operation_tree"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='quantity']" position="after">
<field name="is_collected" widget="boolean_toggle"
readonly="state in ('done', 'cancel')"/>
</xpath>
</field>
</record>
<record id="view_picking_type_form_inherit_collect" model="ir.ui.view">
<field name="name">stock.picking.type.form.collect</field>
<field name="model">stock.picking.type</field>
<field name="inherit_id" ref="stock.view_picking_type_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='create_backorder']" position="after">
<field name="collected_check_required"/>
</xpath>
</field>
</record>
</odoo>