[FIX] product_catalog_tree: clear context when updating order line info#837
[FIX] product_catalog_tree: clear context when updating order line info#837cav-adhoc wants to merge 1 commit intoingadhoc:18.0from
Conversation
There was a problem hiding this comment.
Pull request overview
Este PR corrige un error que ocurría al utilizar el árbol de catálogo de productos desde facturas. El problema se originaba cuando claves de contexto de la UI se pasaban al crear líneas de movimiento contable, causando errores. La solución limpia el contexto antes de llamar al método de actualización de líneas de orden.
| # Actualizar la información de la línea de orden | ||
| order.with_company(order.company_id)._update_order_line_info(rec.id, product_catalog_qty) | ||
| # Call the order method with a cleared context to avoid errors on creating move line | ||
| order.with_company(order.company_id).with_context(**{})._update_order_line_info(rec.id, product_catalog_qty) |
There was a problem hiding this comment.
El uso de with_context(**{}) elimina TODO el contexto, incluyendo información crítica como lang, tz y uid. Esto puede causar problemas en traducciones, zona horaria o permisos. Es mejor usar with_context(clear_context=True) o crear un diccionario explícito con solo las claves necesarias a eliminar (por ejemplo, las claves de UI que causan el problema).
| order.with_company(order.company_id).with_context(**{})._update_order_line_info(rec.id, product_catalog_qty) | |
| order.with_company(order.company_id).with_context(clear_context=True)._update_order_line_info(rec.id, product_catalog_qty) |
| for rec in self: | ||
| # Actualizar la información de la línea de orden | ||
| order.with_company(order.company_id)._update_order_line_info(rec.id, product_catalog_qty) | ||
| # Call the order method with a cleared context to avoid errors on creating move line |
There was a problem hiding this comment.
El comentario está en inglés mientras que el comentario anterior (línea 61) está en español. Para mantener consistencia en el código, ambos comentarios deberían estar en el mismo idioma. Se recomienda usar español para mantener coherencia con el resto del archivo.
58e93c5 to
d8c01e6
Compare
When using catalog tree from invoices a context with UI keys is passed and that produces errors when creating account move lines. This commit clears the context when calling the order method to avoid such issues.
d8c01e6 to
351eb26
Compare
|
@roboadhoc r+ |
When using catalog tree from invoices a context with UI keys is passed and that produces errors when creating account move lines. This commit clears the context when calling the order method to avoid such issues. closes #837 Signed-off-by: rov-adhoc <rov@adhoc.com.ar>

When using catalog tree from invoices a context with UI keys is passed and that produces errors when creating account move lines. This commit clears the context when calling the order method to avoid such issues.