[FIX] prodct_catalog_tree: left a minimal context when updating line#840
[FIX] prodct_catalog_tree: left a minimal context when updating line#840vib-adhoc merged 1 commit intoingadhoc:18.0from
Conversation
There was a problem hiding this comment.
Pull request overview
Este PR intenta corregir un problema al limpiar el contexto antes de llamar a _update_order_line_info para evitar errores al crear move lines. Sin embargo, el cambio implementado no logra el objetivo deseado.
Cambios clave:
- Se reemplaza
with_context(clear_context=True)porwith_context(**{})en el método_inverse_catalog_values
| order.with_company(order.company_id).with_context(clear_context=True)._update_order_line_info( | ||
| rec.id, product_catalog_qty | ||
| ) | ||
| 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 código with_context(**{}) no limpia el contexto como se pretende. Pasar un diccionario vacío como **{} equivale a no pasar argumentos, por lo que el contexto permanece sin cambios.
Para limpiar completamente el contexto en Odoo, utiliza with_context({}) (sin el operador **) o with_env(self.env(context={})).
El comentario en la línea 62 indica que se quiere evitar errores al crear move lines, y eso requiere realmente limpiar el contexto.
| 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({})._update_order_line_info(rec.id, product_catalog_qty) |
ef82207 to
7a89d3f
Compare
7a89d3f to
e1f3e69
Compare
| minimal_context = { | ||
| "lang": self._context.get("lang"), | ||
| "tz": self._context.get("tz"), | ||
| "uid": self._context.get("uid"), |
There was a problem hiding this comment.
El diccionario minimal_context incluye la clave "uid", pero uid no es una clave válida del contexto en Odoo. El uid es un atributo del environment (self.env.uid), no del contexto. Las claves típicas del contexto son lang, tz, allowed_company_ids, etc. Esta línea debería eliminarse, ya que el uid se hereda automáticamente al crear un nuevo environment con self.env(context=...).
| "uid": self._context.get("uid"), |
| minimal_context = { | ||
| "lang": self._context.get("lang"), | ||
| "tz": self._context.get("tz"), | ||
| "uid": self._context.get("uid"), | ||
| "allowed_company_ids": self._context.get("allowed_company_ids"), | ||
| } | ||
| order.with_company(order.company_id).with_env(self.env(context=minimal_context))._update_order_line_info( |
There was a problem hiding this comment.
Se están realizando modificaciones en el código del modelo (models/product_product.py) pero no se ha incrementado la versión en __manifest__.py. Según las directrices del proyecto, cuando se modifican archivos de modelos, vistas, datos o seguridad, debe incrementarse la versión (por ejemplo, de 18.0.1.3.0 a 18.0.1.3.1).
| # Actualizar la información de la línea de orden | ||
| # Call the order method with a cleared context to avoid errors on creating move line | ||
| order.with_company(order.company_id).with_context(clear_context=True)._update_order_line_info( | ||
| minimal_context = { |
There was a problem hiding this comment.
El título del PR contiene un error tipográfico: "prodct_catalog_tree" debería ser "product_catalog_tree".
|
@roboadhoc r+ |
closes #840 Signed-off-by: Filoquin adhoc <maq@adhoc.com.ar>
|
@cav-adhoc unknown command 'check-state'. For your own safety I've ignored everything in your entire comment. Currently available commands:
Note: this help text is dynamic and will change with the state of the PR. |
|
@roboadhoc check |
|
Updated message. No update to pr head. |
|
@roboadhoc r+ |
|
This PR is already reviewed, reviewing it again is useless. |
e1f3e69 to
13bf96c
Compare
|
@roboadhoc check |
|
Updated message. No update to pr head. |

No description provided.