Bessam Djerad
Bessam Djerad

Reputation: 1

Show list of available product fields for Inventory Adjustments (to find the barcode field)

I would like to add the barcode of my products to the product list in the inventory list in the inventory adjustments. The view list is:

<?xml version="1.0"?>
<tree editable="top" string="Inventory Details" decoration-info="product_qty != theoretical_qty" decoration-danger="theoretical_qty &lt; 0">
    <field name="product_id" domain="[('type','=','product')]"/>
    <field name="product_uom_id" string="UoM" groups="product.group_uom"/>
    <field name="location_id" domain="[('id', 'child_of', inventory_location_id)]" groups="stock.group_stock_multi_locations"/>
    <field name="prod_lot_id" domain="[('product_id', '=', product_id)]" context="{'default_product_id': product_id}" groups="stock.group_production_lot"/>
    <field name="package_id" domain="['|', ('location_id','=', False), ('location_id', '=', location_id)]" groups="stock.group_tracking_lot"/>
    <field name="partner_id" groups="stock.group_tracking_owner"/>
    <field name="theoretical_qty" readonly="1"/>
    <field name="product_qty" string="Real Quantity"/>
    <field name="state" invisible="1"/>
    <field name="inventory_id" invisible="1"/>
    <field name="inventory_location_id" invisible="1"/>
</tree>

If I try to add the field <field name="product_id.barcode" /> I am told that:

Field product_id.barcode does not exist

How to see all the fields that are possible to add in this list?

Upvotes: 0

Views: 84

Answers (1)

Harlan
Harlan

Reputation: 101

Seems like you can't go throughout models in XML views. You can add a related field to the model you're displaying in this view basically like that : barcode = fields.Char(related='product_id.barcode') then you can show it in your view like this : <field name="barcode"/>.

Upvotes: 1

Related Questions