Skip to content

Conversation

@JacoBinaural
Copy link
Contributor

@JacoBinaural JacoBinaural commented Nov 8, 2025

Problema:

-Se requiere migrar configuraciones de stock de Integra a Homologado

Solución:

-Se migra la configuración not_allow_negative_inventory_adjustments

-Se migra la configuración allow_scrap_more_than_available

-Se migra not_allow_scrap_more_than_what_was_manufactured

-Se migra not_allow_negative_stock_movement

Tarea (Link):

Tarea de proyecto []

Ticket de soporte [x]

Jaco added 4 commits November 8, 2025 15:51
Problema:

-Se requiere migrar configuraciones de stock de Integra a Homologado

Solución:

-Se migra la configuración not_allow_negative_inventory_adjustments

-Se migra la configuración allow_scrap_more_than_available

-Se migra not_allow_scrap_more_than_what_was_manufactured

-Se migra not_allow_negative_stock_movement

Tarea (Link):

Tarea de proyecto []

Ticket de soporte [x]
Problema:
-Se requiere incluir los movimientos de inventario de tipo entrega en la validación para ver si hay suficiente stock disponible para el movimiento a realizar.
Solución:
-Se agrega el tipo outgoing en la validación para que entre la configuración en función.
Tarea (Link):
https://binaural.odoo.com/web#id=9422&cids=2&menu_id=293&action=389&model=helpdesk.ticket&view_type=form

Tarea de proyecto []
Ticket de soporte [x]
Copilot AI review requested due to automatic review settings November 8, 2025 19:53
@mergify
Copy link

mergify bot commented Nov 8, 2025

Merge Protections

Your pull request matches the following merge protections and will not be merged until they are valid.

🔴 Require a review from approvers team

This rule is failing.

This rule requires someone from the approver's team to approve the PR

  • approved-reviews-by = @probadores

@JacoBinaural JacoBinaural self-assigned this Nov 8, 2025
@JacoBinaural JacoBinaural added 19.0 🔄 En validación Etiqueta de estado de revisión: En revisión por el consultor funcional. labels Nov 8, 2025
@JacoBinaural JacoBinaural requested review from OmarYepez29 and removed request for Copilot November 8, 2025 19:57
Copilot AI review requested due to automatic review settings November 8, 2025 23:34
Copy link
Contributor

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 añade cuatro nuevas configuraciones de control de inventario para el módulo de stock de Venezuela, permitiendo a las empresas aplicar restricciones sobre ajustes de inventario negativos, desechos y movimientos de stock.

  • Añade validaciones para prevenir ajustes de inventario negativos, desechos excesivos y movimientos de stock negativos
  • Implementa campos de configuración a nivel de empresa para controlar estos comportamientos
  • Incluye traducciones al español venezolano para todas las nuevas funcionalidades

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
l10n_ve_stock/manifest.py Actualiza la versión del módulo de 1.0 a 1.1
l10n_ve_stock/models/init.py Añade la importación del nuevo modelo stock_scrap
l10n_ve_stock/models/res_company.py Define cuatro nuevos campos booleanos para las configuraciones de control de inventario
l10n_ve_stock/models/res_config_settings.py Añade campos de configuración relacionados con las nuevas restricciones de inventario
l10n_ve_stock/models/stock_scrap.py Implementa validaciones para controlar desechos basado en disponibilidad y cantidades manufacturadas
l10n_ve_stock/models/stock_quant.py Añade validación para prevenir ajustes de inventario negativos
l10n_ve_stock/models/stock_picking.py Implementa validación para prevenir movimientos de stock negativos en transferencias internas
l10n_ve_stock/views/res_config_settings_views.xml Añade controles de interfaz de usuario para las cuatro nuevas configuraciones
l10n_ve_stock/i18n/es_VE.po Añade traducciones al español venezolano para mensajes, etiquetas de campos y descripciones
Comments suppressed due to low confidence (1)

l10n_ve_stock/models/stock_picking.py:244

  • Mixing implicit and explicit returns may indicate an error, as implicit returns always return None.
    def button_validate(self):

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +16 to +37

if not self.env.company.not_allow_scrap_more_than_what_was_manufactured:
return super(StockScrap,self).action_validate()

if self.production_id:
count = 0
if self.production_id.scrap_ids:
for scrap in self.production_id.scrap_ids.filtered(
lambda scrap: scrap.state == "done"
):
count += scrap.scrap_qty
if (
count >= self.production_id.qty_produced
or (self.scrap_qty + count) > self.production_id.qty_produced
or self.scrap_qty > self.production_id.qty_produced
):
raise ValidationError(
_(
"No more than what is manufactured can be discarded in this operation."
)
)

Copy link

Copilot AI Nov 8, 2025

Choose a reason for hiding this comment

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

La lógica de este método tiene un problema: cuando not_allow_scrap_more_than_what_was_manufactured es False (línea 17), el método retorna inmediatamente sin verificar allow_scrap_more_than_available (líneas 13-15). Esto significa que si not_allow_scrap_more_than_what_was_manufactured está deshabilitado, se ignora completamente la verificación de allow_scrap_more_than_available. Ambas verificaciones deben ejecutarse independientemente.

Suggested change
if not self.env.company.not_allow_scrap_more_than_what_was_manufactured:
return super(StockScrap,self).action_validate()
if self.production_id:
count = 0
if self.production_id.scrap_ids:
for scrap in self.production_id.scrap_ids.filtered(
lambda scrap: scrap.state == "done"
):
count += scrap.scrap_qty
if (
count >= self.production_id.qty_produced
or (self.scrap_qty + count) > self.production_id.qty_produced
or self.scrap_qty > self.production_id.qty_produced
):
raise ValidationError(
_(
"No more than what is manufactured can be discarded in this operation."
)
)
if self.env.company.not_allow_scrap_more_than_what_was_manufactured:
if self.production_id:
count = 0
if self.production_id.scrap_ids:
for scrap in self.production_id.scrap_ids.filtered(
lambda scrap: scrap.state == "done"
):
count += scrap.scrap_qty
if (
count >= self.production_id.qty_produced
or (self.scrap_qty + count) > self.production_id.qty_produced
or self.scrap_qty > self.production_id.qty_produced
):
raise ValidationError(
_(
"No more than what is manufactured can be discarded in this operation."
)
)

Copilot uses AI. Check for mistakes.
raise ValidationError(_("You cannot scrap more than the available product quantity in this location."))

if not self.env.company.not_allow_scrap_more_than_what_was_manufactured:
return super(StockScrap,self).action_validate()
Copy link

Copilot AI Nov 8, 2025

Choose a reason for hiding this comment

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

Falta un espacio después de la coma en super(StockScrap,self). Debería ser super(StockScrap, self).

Suggested change
return super(StockScrap,self).action_validate()
return super(StockScrap, self).action_validate()

Copilot uses AI. Check for mistakes.
function.
:return: The stock moves resulting from the inventory adjustment
"""
_logger.warning("Entering _apply_inventory method.")
Copy link

Copilot AI Nov 8, 2025

Choose a reason for hiding this comment

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

El mensaje de advertencia de depuración no debe estar en el código de producción. Este tipo de mensajes de registro debe eliminarse o cambiarse a un nivel más apropiado (debug) una vez completada la depuración.

Suggested change
_logger.warning("Entering _apply_inventory method.")
# _logger.debug("Entering _apply_inventory method.") # Mensaje de depuración eliminado para producción

Copilot uses AI. Check for mistakes.
"Insufficient stock:\n"
"%s\n"
"\n"
"Adjust quantitys or request stock for this location."
Copy link

Copilot AI Nov 8, 2025

Choose a reason for hiding this comment

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

Error de ortografía en el archivo de traducción: "quantitys" debería ser "quantities". Esta misma corrección debe aplicarse tanto en la cadena msgid como en la traducción msgstr correspondiente.

Suggested change
"Adjust quantitys or request stock for this location."
"Adjust quantities or request stock for this location."

Copilot uses AI. Check for mistakes.
Comment on lines +69 to +101
<div class="col-12 col-lg-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="allow_scrap_more_than_available"/>
</div>
<div class="o_setting_right_pane">
<label for="allow_scrap_more_than_available"/>
<div class="text-muted"> Allow to scrap more than available quantity in stock. </div>
</div>
</div>

<div class="col-12 col-lg-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="not_allow_scrap_more_than_what_was_manufactured" />
</div>
<div class="o_setting_right_pane">
<label for="not_allow_scrap_more_than_what_was_manufactured"/>
<div class="text-muted">
<strong>When marked:</strong> No more than what is manufactured in an order may be scrapped.<br/>
<strong>When unchecked:</strong> More than what is manufactured in an order may be scrapped.
</div>
</div>
</div>
<div class="col-12 col-lg-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="not_allow_negative_stock_movement"/>
</div>
<div class="o_setting_right_pane">
<label for="not_allow_negative_stock_movement"/>
<div class="text-muted">
<span>Do not allow negative stock in internal movements</span>
</div>
</div>
</div>
Copy link

Copilot AI Nov 8, 2025

Choose a reason for hiding this comment

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

Hay un problema de espaciado inconsistente en este archivo XML. Las líneas 69-77, 79-90, y 91-101 usan tabulaciones (tabs) en lugar de espacios, mientras que el resto del archivo usa espacios. Esto crea inconsistencias visuales y dificulta el mantenimiento del código. Se debe usar espacios consistentemente en todo el archivo XML.

Copilot generated this review using guidance from organization custom instructions.
Comment on lines 246 to 255
res = super(StockPicking, self).button_validate()

if isinstance(res, dict) and res.get('res_model') == 'stock.backorder.confirmation':

return res

else:

self._check_stock_availability_for_pickings()

Copy link

Copilot AI Nov 8, 2025

Choose a reason for hiding this comment

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

La lógica de este método es incorrecta. Cuando not_allow_negative_stock_movement está habilitado, primero llama a super().button_validate() (línea 246), lo que puede completar el proceso de validación antes de realizar la verificación de disponibilidad de stock (línea 254). Esto significa que los movimientos negativos de stock podrían permitirse antes de que se ejecute la validación. Las verificaciones deben realizarse ANTES de llamar a super().button_validate(). Además, el método no devuelve nada cuando no se detectan problemas de stock, lo cual puede causar problemas.

Suggested change
res = super(StockPicking, self).button_validate()
if isinstance(res, dict) and res.get('res_model') == 'stock.backorder.confirmation':
return res
else:
self._check_stock_availability_for_pickings()
self._check_stock_availability_for_pickings()
res = super(StockPicking, self).button_validate()
return res
else:
return super(StockPicking, self).button_validate()

Copilot uses AI. Check for mistakes.

if stock_msg:
error_msg = _(
"Insufficient stock:\n%s\n\nAdjust quantitys or request stock for this location."
Copy link

Copilot AI Nov 8, 2025

Choose a reason for hiding this comment

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

Error de ortografía en el mensaje de error: "quantitys" debería ser "quantities".

Suggested change
"Insufficient stock:\n%s\n\nAdjust quantitys or request stock for this location."
"Insufficient stock:\n%s\n\nAdjust quantities or request stock for this location."

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,38 @@
# -*- coding: utf-8 -*-
from odoo import fields,models
Copy link

Copilot AI Nov 8, 2025

Choose a reason for hiding this comment

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

Falta un espacio después de la coma en la importación. Debería ser from odoo import fields, models en lugar de from odoo import fields,models.

Suggested change
from odoo import fields,models
from odoo import fields, models

Copilot uses AI. Check for mistakes.
@@ -1,8 +1,10 @@
import traceback
Copy link

Copilot AI Nov 8, 2025

Choose a reason for hiding this comment

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

Import of 'traceback' is not used.

Suggested change
import traceback

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,38 @@
# -*- coding: utf-8 -*-
from odoo import fields,models
Copy link

Copilot AI Nov 8, 2025

Choose a reason for hiding this comment

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

Import of 'fields' is not used.

Suggested change
from odoo import fields,models
from odoo import models

Copilot uses AI. Check for mistakes.
Jaco added 2 commits November 9, 2025 17:19
Problema:
-Al intentar validar un stock picking, el botón no realiza ninguna acción.
Solución:
-Se agregan return para los casos necesarios.
Tarea (Link):

Tarea de proyecto [x]
Ticket de soporte []
Problema:
-Al intentar actualizar cantidades de un producto en inventario a través
de la interfaz de actualizar cantidades, muestra error ya que
_apply_inventory está esperando un parámetro.

Solución:
-Se agrega date=None en los argumentos del método _apply_inventory, este
en V19 es requerido para la ejecución de la función correctamente.
Tarea (Link):
https://binaural.odoo.com/web#id=59671&cids=2&model=project.task&view_type=form

Tarea de proyecto [x]
Ticket de soporte []
@JacoBinaural JacoBinaural force-pushed the dev-19_FEAT_ti_#9422_migration_stock_configurations branch from 531f5ea to a0fb49e Compare November 10, 2025 13:38
Problema:
-Al realizar movimientos de inventario, no se valida la disponibilidad de los productos a pesar de tener activada la configuración.
Solución:
-Se cambia la validación de tipo de producto a 'consu' ya que product fue eliminada en esta versión de odoo.
Tarea (Link):
https://binaural.odoo.com/web#id=9422&cids=2&menu_id=293&action=389&model=helpdesk.ticket&view_type=form
Tarea de proyecto [x]
Ticket de soporte []
@JacoBinaural JacoBinaural requested a review from a team November 11, 2025 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

19.0 🔄 En validación Etiqueta de estado de revisión: En revisión por el consultor funcional.

Development

Successfully merging this pull request may close these issues.

2 participants