Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion sale_ux/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,18 @@ def create(self, vals_list):
._get_model_defaults(self._name)
.get("specific_property_product_pricelist", False)
)
skip_specific = False
if pricelist.country_group_ids and not partner.country_id:
# La primera lista requiere país y el partner no tiene país
# → Si el default es distinto, NO asignamos specific
skip_specific = True
Comment on lines +29 to +32
Copy link

Copilot AI Nov 19, 2025

Choose a reason for hiding this comment

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

La condición en la línea 29 no verifica si pricelist está vacío. Si search([], limit=1, order="sequence") no encuentra ninguna lista de precios, pricelist será un recordset vacío y acceder a pricelist.country_group_ids podría resultar en un recordset vacío (que es falsy), evitando el error pero potencialmente ocultando un problema de configuración.

Considera agregar una validación explícita al inicio del bucle:

if not pricelist:
    continue  # o raise un error apropiado

Copilot uses AI. Check for mistakes.

if default_pricelist_id:
if default_pricelist_id != pricelist.id:
partner.specific_property_product_pricelist = default_pricelist_id
if not skip_specific:
partner.specific_property_product_pricelist = default_pricelist_id
else:
partner.specific_property_product_pricelist = None
else:
partner.specific_property_product_pricelist = None
Comment on lines +28 to 41
Copy link

Copilot AI Nov 19, 2025

Choose a reason for hiding this comment

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

Se modificó la lógica del método create en models/res_partner.py pero no se incrementó la versión en __manifest__.py. Según las reglas del proyecto, cuando hay cambios en modelos se debe hacer un bump de versión (por ejemplo, de 18.0.1.12.0 a 18.0.1.13.0).

Copilot generated this review using guidance from repository custom instructions.
else:
Expand Down