Skip to content

[FIX] sale_stock_ux: self.product_uom → self.product_uom_id (v19 compat)#1633

Open
matiasgibbons wants to merge 1 commit intoingadhoc:19.0from
matiasgibbons:19.0
Open

[FIX] sale_stock_ux: self.product_uom → self.product_uom_id (v19 compat)#1633
matiasgibbons wants to merge 1 commit intoingadhoc:19.0from
matiasgibbons:19.0

Conversation

@matiasgibbons
Copy link
Copy Markdown

Summary

In v19 the field sale.order.line.product_uom was renamed to product_uom_id. Three calls in sale_stock_ux/models/sale_order_line.py still used the old name on the sale.order.line recordset, raising AttributeError when the model is loaded post-migration:

AttributeError: 'sale.order.line' object has no attribute 'product_uom'

Affected methods:

  • _get_qty_procurement (was breaking on the 2nd argument of _compute_quantity)
  • _compute_quantity_returned (BOM kits branch, was breaking for orders with kit products)

What changed

self.product_uomself.product_uom_id and order_line.product_uomorder_line.product_uom_id.

Note: move.product_uom / move_ids.product_uom (on stock.move) is still valid in v19 and was left untouched — only the sale.order.line access needed the rename.

Reproduction

Fresh migration from v18 to v19 (upgrade.odoo.com test) followed by -u all on a database that has sale orders with exchange moves or BOM kits triggered the traceback.

Test plan

  • Migrated a real production DB (v18 → v19 via upgrade.odoo.com) and ran -u all — without this fix the registry fails to load; with the fix it completes cleanly.
  • _get_qty_procurement returns correct quantities for exchange moves between different UoMs.

En v19 el campo sale.order.line.product_uom fue renombrado a product_uom_id.
En _get_qty_procurement (lineas 62/65) y _compute_quantity_returned (linea
245) se accedia al nombre viejo sobre el recordset de sale.order.line,
disparando AttributeError al cargar el modelo post-migracion:

    AttributeError: sale.order.line object has no attribute product_uom

Nota: move.product_uom (stock.move) sigue siendo valido en v19, por eso no
se tocan los accesos sobre "move" ni sobre "move_ids".
Copilot AI review requested due to automatic review settings April 17, 2026 04:01
@roboadhoc
Copy link
Copy Markdown
Contributor

Pull request status dashboard

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 una incompatibilidad con Odoo v19 en sale_stock_ux, reemplazando accesos obsoletos al campo sale.order.line.product_uom (renombrado en v19) por el campo correcto product_uom_id, evitando el AttributeError durante carga/actualización del módulo tras migración.

Changes:

  • Sustituye self.product_uom por self.product_uom_id en conversiones de UoM dentro de _get_qty_procurement.
  • Sustituye order_line.product_uom por order_line.product_uom_id en el cálculo de kits dentro de _compute_quantity_returned.

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