Skip to content

[IMP] stock_ux: add the transfer's scheduled date on move lines - #1005

Open
mav-adhoc wants to merge 1 commit into
ingadhoc:19.0from
adhoc-dev:19.0-h-125611-mav
Open

[IMP] stock_ux: add the transfer's scheduled date on move lines#1005
mav-adhoc wants to merge 1 commit into
ingadhoc:19.0from
adhoc-dev:19.0-h-125611-mav

Conversation

@mav-adhoc

@mav-adhoc mav-adhoc commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Problem

stock.move.line.scheduled_date is related to move_id.date, and stock.move.date only holds the scheduled date until the move is done_action_done overwrites it with the processing date, as its own help states. Moves History (Inventory > Reporting) lists done lines, so filtering, grouping or sorting by "Scheduled Date" there silently uses the effective date, and it contradicts the "Scheduled Date" of the transfer, which does survive the validation (stock.picking._compute_scheduled_date ignores done moves).

Steps to reproduce

  1. Create a receipt scheduled tomorrow and validate it today.
  2. Inventory > Reporting > Moves History, group by "Scheduled Date".
  3. The line falls under today instead of tomorrow, while the transfer form still shows tomorrow.

Why a new field instead of fixing the native one

I proposed changing the native field upstream in odoo/odoo#283087. Odoo declined it for 19.0 to avoid changing an existing field's value mid-version, and master then removed stock.move.line.scheduled_date altogether (odoo/odoo#276163, 90654e4c74e, date becomes a stored related on move_id.date). So there is no upstream fix coming to 19.0, and overriding the native related here would change, in every database, the value people may already be grouping by — and it would resurrect a field that no longer exists in the next version.

Adding a separate field keeps both properties: nothing changes for the native one, and this one survives the upgrade because it is ours.

Changes

  • picking_scheduled_date, related to picking_id.scheduled_date.
  • Available as a group by in the move lines search view, and as an optional (hidden by default) column of the report list.
  • Lines without a transfer are empty on the new field, and keep showing whatever the native field shows.

Version

The manifest is bumped in the PR (19.0.1.17.0), a new field plus view changes need the module to be updated on deploy — so this one merges with nobump.

Internal reference: https://www.adhoc.inc/odoo/helpdesk.ticket/125611

Copilot AI lite review requested due to automatic review settings August 24, 2026 16:03
@roboadhoc

Copy link
Copy Markdown
Collaborator

Pull request status dashboard

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Este PR busca preservar la “fecha programada” real del traspaso (picking) en el histórico de movimientos/líneas, evitando que al validar un picking las líneas terminen agrupándose por la fecha de proceso (cuando stock.move.date es sobrescrito al hacer _action_done).

Changes:

  • Agrega en stock.move.line el campo picking_scheduled_date relacionado a picking_id.scheduled_date.
  • Expone el nuevo campo como group by en la búsqueda de líneas y como columna opcional en la lista del reporte.
  • Incorpora un test que valida que la fecha del picking “sobrevive” a la validación mientras que la fecha nativa ya no lo hace.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
stock_ux/models/stock_move_line.py Nuevo campo picking_scheduled_date relacionado al scheduled del picking.
stock_ux/views/stock_move_line_views.xml Agrega group-by y columna opcional para el nuevo campo en vistas de líneas.
stock_ux/tests/test_move_line_picking_scheduled_date.py Test de regresión para validar el comportamiento post-validación.
stock_ux/tests/init.py Incluye el nuevo archivo de tests en el paquete.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +34 to +39
picking_scheduled_date = fields.Datetime(
related="picking_id.scheduled_date",
string="Transfer Scheduled Date",
help="Scheduled date of the transfer. Unlike Scheduled Date, it is not replaced by the "
"processing date once the move is done.",
)
The native stock.move.line.scheduled_date is related to move_id.date, which
stops being the scheduled date once the move is validated: _action_done
overwrites it with the processing date. So in Moves History, which lists done
lines, filtering or grouping by "Scheduled Date" silently uses the effective
date, and it contradicts the date shown on the transfer, which does survive
the validation.

Odoo will not change that on 19.0, and master removed the field altogether
(odoo/odoo#276163), so instead of overriding the native field this adds a new
one following picking_id.scheduled_date, available as a group by and as an
optional column of the report. Nothing changes for whoever uses the native
field, and lines without a transfer keep behaving as before.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants