Compare commits

...

2 commits

Author SHA1 Message Date
GitHub Copilot
9547193083 [IMP] stock_picking_batch_custom: show product code as separate optional column
Add product_default_code related field to stock.move.line and
stock.picking.batch.summary.line. Show it as a hidden-by-default column
to the right of product_id in both detailed operations and product summary
views. Hide the code prefix from the product name via display_default_code
context so sorting is alphabetical.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-21 16:44:54 +02:00
GitHub Copilot
f25d2b5e2c [IMP] stock_picking_batch_custom: hide location and picking fields by default in detailed ops
Hide location_id, location_dest_id and picking_id (optional=hide) in the
detailed operations list view to reduce visual clutter.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-21 16:40:26 +02:00
3 changed files with 28 additions and 3 deletions

View file

@ -17,6 +17,12 @@ class StockMoveLine(models.Model):
readonly=True,
)
product_default_code = fields.Char(
string="Product Code",
related="product_id.default_code",
readonly=True,
)
is_collected = fields.Boolean(
string="Collected",
default=False,

View file

@ -253,6 +253,11 @@ class StockPickingBatchSummaryLine(models.Model):
store=True,
readonly=True,
)
product_default_code = fields.Char(
string="Product Code",
related="product_id.default_code",
readonly=True,
)
product_uom_id = fields.Many2one(
comodel_name="uom.uom",
string="Unit of Measure",

View file

@ -5,10 +5,9 @@
<field name="model">stock.picking.batch.summary.line</field>
<field name="arch" type="xml">
<list create="0" delete="0" default_order="product_categ_id,product_id">
<!-- Mostrar categoría a la izquierda del producto para mejor legibilidad -->
<field name="product_categ_id" readonly="1"/>
<field name="product_id" readonly="1"/>
<!-- Unidad de medida opcional (oculta por defecto si el usuario lo decide) -->
<field name="product_id" readonly="1" context="{'display_default_code': False}"/>
<field name="product_default_code" readonly="1" optional="hide"/>
<field name="product_uom_id" readonly="1" optional="hide"/>
<field name="qty_demanded" readonly="1"/>
<field name="qty_done" readonly="1"/>
@ -50,12 +49,27 @@
<xpath expr="//field[@name='product_id']" position="before">
<field name="product_categ_id" readonly="1"/>
</xpath>
<xpath expr="//field[@name='product_id']" position="attributes">
<attribute name="context">{'display_default_code': False}</attribute>
</xpath>
<xpath expr="//field[@name='product_id']" position="after">
<field name="product_default_code" readonly="1" optional="hide"/>
</xpath>
<xpath expr="//field[@name='product_uom_id']" position="attributes">
<attribute name="optional">hide</attribute>
</xpath>
<xpath expr="//field[@name='company_id'][@groups='base.group_multi_company']" position="attributes">
<attribute name="optional">hide</attribute>
</xpath>
<xpath expr="//field[@name='picking_id']" position="attributes">
<attribute name="optional">hide</attribute>
</xpath>
<xpath expr="//field[@name='location_id']" position="attributes">
<attribute name="optional">hide</attribute>
</xpath>
<xpath expr="//field[@name='location_dest_id']" position="attributes">
<attribute name="optional">hide</attribute>
</xpath>
</field>
</record>