[FIX] sale_stock_ux: self.product_uom → self.product_uom_id (v19 compat)#1633
Open
matiasgibbons wants to merge 1 commit intoingadhoc:19.0from
Open
[FIX] sale_stock_ux: self.product_uom → self.product_uom_id (v19 compat)#1633matiasgibbons wants to merge 1 commit intoingadhoc:19.0from
matiasgibbons wants to merge 1 commit intoingadhoc:19.0from
Conversation
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".
Contributor
Contributor
There was a problem hiding this comment.
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_uomporself.product_uom_iden conversiones de UoM dentro de_get_qty_procurement. - Sustituye
order_line.product_uompororder_line.product_uom_iden el cálculo de kits dentro de_compute_quantity_returned.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
In v19 the field
sale.order.line.product_uomwas renamed toproduct_uom_id. Three calls insale_stock_ux/models/sale_order_line.pystill used the old name on thesale.order.linerecordset, raisingAttributeErrorwhen the model is loaded post-migration: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_uom→self.product_uom_idandorder_line.product_uom→order_line.product_uom_id.Note:
move.product_uom/move_ids.product_uom(onstock.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.comtest) followed by-u allon a database that has sale orders with exchange moves or BOM kits triggered the traceback.Test plan
-u all— without this fix the registry fails to load; with the fix it completes cleanly._get_qty_procurementreturns correct quantities for exchange moves between different UoMs.