Skip to content
Open
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions stock_ux/models/res_config_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ class ResConfigSettings(models.TransientModel):
config_parameter="stock_ux.delivery_slip_use_origin",
)

delivery_slip_add_product_name = fields.Boolean(
"Agregar el nombre del producto a la descripción de origen",
config_parameter="stock_ux.delivery_slip_add_product_name",
)

delivery_slip_remaining_qty = fields.Boolean(
"En Comprobantes de Transferencia mostrar cantidades pendientes de entrega",
config_parameter="stock_ux.delivery_slip_remaining_qty",
Expand Down
10 changes: 9 additions & 1 deletion stock_ux/models/stock_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@ def _get_aggregated_properties(self, move_line=False, move=False):
origin_description = move.origin_description or reference
product = move.product_id

add_product_name = (
self.env["ir.config_parameter"].sudo().get_param("stock_ux.delivery_slip_add_product_name", "False")
== "True"
)

# Clean the origin_description by removing product name prefix
clean_description = origin_description
if origin_description != reference:
Expand All @@ -159,7 +164,10 @@ def _get_aggregated_properties(self, move_line=False, move=False):
elif origin_description.startswith(product.name):
clean_description = origin_description.removeprefix(product.name).strip()

name = clean_description if clean_description else origin_description
if add_product_name and clean_description and clean_description != origin_description:
name = f"{product.name} {'-'} {clean_description}"
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

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

El formato de la cadena incluye un guión entre espacios innecesarios. La expresión f"{product.name} {'-'} {clean_description}" genera algo como "Producto - Descripción", pero debería ser simplemente f"{product.name} - {clean_description}" para evitar la redundancia de espacios alrededor del guión.

Suggested change
name = f"{product.name} {'-'} {clean_description}"
name = f"{product.name} - {clean_description}"

Copilot uses AI. Check for mistakes.
else:
name = clean_description if clean_description else origin_description
line_key = f"{product.id}_{name}_{uom.id}_{move.packaging_uom_id or ''}"
bom_line = getattr(move, "bom_line_id", False)
if bom_line and bom_line.bom_id:
Expand Down
6 changes: 6 additions & 0 deletions stock_ux/views/res_config_settings_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@
<div class="text-muted">
Por defecto odoo imprime en los Comprobantes de Transferencia el nombre del producto, si marca esta opción en su lugar se utilizará la descripción de origen (la descripción de origen suele ser la descripción de venta o la descripción de la compra)
</div>
<div class="content-group mt-3" invisible="not delivery_slip_use_origin">
<div class="row mt-2">
<label for="delivery_slip_add_product_name" class="o_light_label col-form-label fw-bold"/>
<field name="delivery_slip_add_product_name" class="ms-2"/>
</div>
</div>
</div>
</div>
<div class="col-xs-12 col-md-6 o_setting_box">
Expand Down