Skip to content

[FIX] stock_ux, stock_batch_picking_ux: drop removed partner mobile field - #982

Open
jue-adhoc wants to merge 1 commit into
ingadhoc:19.0from
adhoc-dev:19.0-h-122884-jue
Open

[FIX] stock_ux, stock_batch_picking_ux: drop removed partner mobile field#982
jue-adhoc wants to merge 1 commit into
ingadhoc:19.0from
adhoc-dev:19.0-h-122884-jue

Conversation

@jue-adhoc

Copy link
Copy Markdown
Contributor

Problem

Printing the shipping label ZPL crashes on 19.0:

QWebError: Error while rendering the template:
    AttributeError: 'res.partner' object has no attribute 'mobile'
    Template: stock_ux.custom_label_transfer_template_view_zpl
    Element: <t t-elif="picking.partner_id and picking.partner_id.mobile"/>

res.partner.mobile no longer exists in 19.0 — it was merged into phone. Both ZPL templates still referenced it:

  • stock_ux.custom_label_transfer_template_view_zpl
  • stock_batch_picking_ux.custom_label_batch_transfer_template_view_zpl (and its PDF variant, which had the same reference)

It went unnoticed because the mobile branch is a t-elif / t-else over the phone one: it is only evaluated when the partner has no phone set. With a phone loaded the label renders fine, which is why this survived the migration.

stock_ux's PDF variant was already fixed in 9007ba2 (#908); the ZPL of the same module was missed, and stock_batch_picking_ux was not covered at all.

Approach

Drop the mobile branches and keep the intended fallback chain: partner phone → parent partner phone. Same shape 9007ba2 applied to the PDF.

In stock_batch_picking_ux the two blocks were a t-if plus a second t-if whose condition manually re-checked that the first one had not matched (... and batch.partner_id.phone == False and ...). Now that mobile is gone those collapse into a plain t-if / t-elif / t-else chain, which is what the manual guard was emulating — same rendering, less to read.

No behaviour change for partners that have a phone.

Test plan

On a 19.0 build, for both stock_ux (picking) and stock_batch_picking_ux (batch):

  1. Partner without phone → print the label (ZPL and PDF): renders with an empty Tel:, no traceback. This is what fails today.
  2. Partner without phone but whose parent company has one → the parent's phone is printed.
  3. Partner with phone → unchanged output.

Merge needs bump — the diff touches data XML that is persisted in ir.ui.view, so the modules must be updated on deploy.

…ield

res.partner.mobile no longer exists in 19.0, it was merged into phone.
The shipping label ZPL templates still referenced it, so printing the
label raised "'res.partner' object has no attribute 'mobile'" whenever
the partner had no phone set (the mobile branch is only evaluated when
the phone one is falsy, which is why it went unnoticed).

Fall back to the parent partner phone instead, as the PDF variant of
stock_ux already does since 9007ba2.
Copilot AI review requested due to automatic review settings July 28, 2026 11:38
@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 corrige el crash al imprimir etiquetas (ZPL/PDF) en Odoo 19.0 eliminando referencias a res.partner.mobile (campo eliminado/mergeado a phone) en templates de reporte de stock_ux y stock_batch_picking_ux.

Changes:

  • stock_ux: elimina ramas t-elif que referenciaban partner_id.mobile (y parent mobile) en el template ZPL.
  • stock_batch_picking_ux: elimina referencias a mobile y simplifica la lógica a una cadena t-if / t-elif / t-else para el fallback de teléfono (partner → parent) tanto en ZPL como en el bloque HTML/PDF.
  • Pendiente: según el propio PR, falta el bump de versión en __manifest__.py de ambos módulos para asegurar que el update aplique los cambios en ir.ui.view.

Reviewed changes

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

File Description
stock_ux/report/picking_templates.xml Quita el uso de partner_id.mobile en el ZPL y mantiene el fallback por phone.
stock_batch_picking_ux/reports/picking_templates.xml Elimina mobile y simplifica el fallback a phone en ZPL y PDF/HTML.

Comment thread stock_batch_picking_ux/reports/picking_templates.xml
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