Skip to content

[FIX] prodct_catalog_tree: left a minimal context when updating line#840

Merged
vib-adhoc merged 1 commit intoingadhoc:18.0from
adhoc-dev:18.0-h-106545-1-cav
Dec 23, 2025
Merged

[FIX] prodct_catalog_tree: left a minimal context when updating line#840
vib-adhoc merged 1 commit intoingadhoc:18.0from
adhoc-dev:18.0-h-106545-1-cav

Conversation

@cav-adhoc
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings December 19, 2025 19:17
@roboadhoc
Copy link
Copy Markdown
Contributor

Pull request status dashboard

Copy link
Copy Markdown

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 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) por with_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)
Copy link

Copilot AI Dec 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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)

Copilot uses AI. Check for mistakes.
@cav-adhoc cav-adhoc changed the title [FIX] prodct_catalog_tree: clear all context before update order [FIX] prodct_catalog_tree: left a minimal context when updating line Dec 19, 2025
@cav-adhoc cav-adhoc requested a review from Copilot December 22, 2025 11:50
Copy link
Copy Markdown

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.

minimal_context = {
"lang": self._context.get("lang"),
"tz": self._context.get("tz"),
"uid": self._context.get("uid"),
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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=...).

Suggested change
"uid": self._context.get("uid"),

Copilot uses AI. Check for mistakes.
Comment on lines +63 to +69
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(
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot generated this review using guidance from repository custom instructions.
# 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 = {
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

El título del PR contiene un error tipográfico: "prodct_catalog_tree" debería ser "product_catalog_tree".

Copilot uses AI. Check for mistakes.
@maq-adhoc
Copy link
Copy Markdown
Contributor

@roboadhoc r+

roboadhoc pushed a commit that referenced this pull request Dec 23, 2025
closes #840

Signed-off-by: Filoquin adhoc <maq@adhoc.com.ar>
@roboadhoc
Copy link
Copy Markdown
Contributor

@cav-adhoc unknown command 'check-state'.

For your own safety I've ignored everything in your entire comment.

Currently available commands:

command
help displays this help
r(eview)- removes approval of a previously approved PR, if the PR is staged the staging will be cancelled
fw=no does not forward-port this PR
fw=default forward-ports this PR normally
up to <branch> only ports this PR forward to the specified branch (included)
check fetches or refreshes PR metadata, resets mergebot state

Note: this help text is dynamic and will change with the state of the PR.

@cav-adhoc
Copy link
Copy Markdown
Contributor Author

@roboadhoc check

@roboadhoc
Copy link
Copy Markdown
Contributor

Updated message. No update to pr head.

@rov-adhoc
Copy link
Copy Markdown
Contributor

@roboadhoc r+

@roboadhoc
Copy link
Copy Markdown
Contributor

This PR is already reviewed, reviewing it again is useless.

@cav-adhoc
Copy link
Copy Markdown
Contributor Author

@roboadhoc check

@roboadhoc
Copy link
Copy Markdown
Contributor

Updated message. No update to pr head.

@vib-adhoc vib-adhoc merged commit 3f07911 into ingadhoc:18.0 Dec 23, 2025
4 checks passed
@vib-adhoc vib-adhoc deleted the 18.0-h-106545-1-cav branch December 23, 2025 17:32
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.

6 participants