[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>
This commit is contained in:
parent
f25d2b5e2c
commit
9547193083
3 changed files with 19 additions and 3 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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,6 +49,12 @@
|
|||
<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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue