显示可用于库存调整的产品字段列表(以查找条形码字段)

时间:2018-09-20 11:03:49

标签: odoo odoo-11

我想将我产品的条形码添加到库存调整中的库存列表中的产品列表中。视图列表是:

<?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>

如果我尝试添加字段<field name="product_id.barcode" />,则会提示:

  

product_id.barcode字段不存在

如何查看可在此列表中添加的所有字段?

1 个答案:

答案 0 :(得分:1)

似乎您无法遍历XML视图中的所有模型。 您可以将基本上像这样的相关字段添加到要在该视图中显示的模型中:barcode = fields.Char(related='product_id.barcode'),然后可以这样在视图中显示它:<field name="barcode"/>