Skip to content

[FIX] product_catalog_tree: fix in product catalog fields#815

Closed
lav-adhoc wants to merge 1 commit intoingadhoc:18.0from
adhoc-dev:18.0-h-102503-lav-2
Closed

[FIX] product_catalog_tree: fix in product catalog fields#815
lav-adhoc wants to merge 1 commit intoingadhoc:18.0from
adhoc-dev:18.0-h-102503-lav-2

Conversation

@lav-adhoc
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings November 12, 2025 14:47
@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 corrige un problema en los campos calculados product_catalog_qty y product_catalog_price del catálogo de productos. El objetivo es garantizar que estos campos se inicialicen correctamente a 0 cuando no hay un contexto válido (sin res_model u order_id), evitando así errores al intentar acceder a valores indefinidos.

Cambios clave

  • Se añaden líneas de inicialización de los campos product_catalog_qty y product_catalog_price a 0 en el método _compute_catalog_values cuando el contexto de orden no está disponible.

Comment on lines +40 to +41
self.product_catalog_qty = 0
self.product_catalog_price = 0
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

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

Al inicializar los campos cuando no hay contexto válido, falta iterar sobre todos los registros del recordset self. En el bloque posterior (líneas 48-50), se itera con for rec in self:, pero aquí se asigna directamente a self, lo que solo funciona correctamente si self contiene un único registro. Si self contiene múltiples registros, esta asignación no funcionará correctamente.

Se debería cambiar a:

for rec in self:
    rec.product_catalog_qty = 0
    rec.product_catalog_price = 0
Suggested change
self.product_catalog_qty = 0
self.product_catalog_price = 0
for rec in self:
rec.product_catalog_qty = 0
rec.product_catalog_price = 0

Copilot uses AI. Check for mistakes.
@matiasperalta1
Copy link
Copy Markdown
Contributor

@roboadhoc r+

roboadhoc pushed a commit that referenced this pull request Nov 13, 2025
closes #815

Signed-off-by: matiasperalta1 <mnp@adhoc.com.ar>
@roboadhoc roboadhoc closed this Nov 13, 2025
@roboadhoc roboadhoc deleted the 18.0-h-102503-lav-2 branch November 13, 2025 14: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.

4 participants