-
Notifications
You must be signed in to change notification settings - Fork 19
Dev 19 feat ti #9422 migration stock configurations #375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev-19
Are you sure you want to change the base?
Dev 19 feat ti #9422 migration stock configurations #375
Conversation
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]
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🔴 Require a review from approvers teamThis rule is failing.This rule requires someone from the approver's team to approve the PR
|
There was a problem hiding this 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.
|
|
||
| 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." | ||
| ) | ||
| ) | ||
|
|
Copilot
AI
Nov 8, 2025
There was a problem hiding this comment.
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.
| 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." | |
| ) | |
| ) |
| 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() |
Copilot
AI
Nov 8, 2025
There was a problem hiding this comment.
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).
| return super(StockScrap,self).action_validate() | |
| return super(StockScrap, self).action_validate() |
| function. | ||
| :return: The stock moves resulting from the inventory adjustment | ||
| """ | ||
| _logger.warning("Entering _apply_inventory method.") |
Copilot
AI
Nov 8, 2025
There was a problem hiding this comment.
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.
| _logger.warning("Entering _apply_inventory method.") | |
| # _logger.debug("Entering _apply_inventory method.") # Mensaje de depuración eliminado para producción |
| "Insufficient stock:\n" | ||
| "%s\n" | ||
| "\n" | ||
| "Adjust quantitys or request stock for this location." |
Copilot
AI
Nov 8, 2025
There was a problem hiding this comment.
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.
| "Adjust quantitys or request stock for this location." | |
| "Adjust quantities or request stock for this location." |
| <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> |
Copilot
AI
Nov 8, 2025
There was a problem hiding this comment.
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.
| 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() | ||
|
|
Copilot
AI
Nov 8, 2025
There was a problem hiding this comment.
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.
| 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() |
|
|
||
| if stock_msg: | ||
| error_msg = _( | ||
| "Insufficient stock:\n%s\n\nAdjust quantitys or request stock for this location." |
Copilot
AI
Nov 8, 2025
There was a problem hiding this comment.
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".
| "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." |
| @@ -0,0 +1,38 @@ | |||
| # -*- coding: utf-8 -*- | |||
| from odoo import fields,models | |||
Copilot
AI
Nov 8, 2025
There was a problem hiding this comment.
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.
| from odoo import fields,models | |
| from odoo import fields, models |
| @@ -1,8 +1,10 @@ | |||
| import traceback | |||
Copilot
AI
Nov 8, 2025
There was a problem hiding this comment.
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.
| import traceback |
| @@ -0,0 +1,38 @@ | |||
| # -*- coding: utf-8 -*- | |||
| from odoo import fields,models | |||
Copilot
AI
Nov 8, 2025
There was a problem hiding this comment.
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.
| from odoo import fields,models | |
| from odoo import models |
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 []
531f5ea to
a0fb49e
Compare
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 []
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]