【发布时间】:2019-06-07 16:37:42
【问题描述】:
我想根据 get_loc_user 字段中的 location_id 过滤 get_parts_locations_rel_ids...但我无法得到它。
我在旧 api 中使用了 odoo 8
# this is my python code
_columns = {
'get_loc_user': fields.function(check_location_user, string="loc_user", type="char"),
'get_parts_locations_rel_ids': fields.one2many('parts.locations_rel','product_id','Locations'),
}
# field 'get_loc_user' is a function that will return a list result such [1,2,3]
#-------------------------------
# in xml
<record id="product_normal_form_view_inherit" model="ir.ui.view">
<field name="name">product.product.form</field>
<field name="model">product.product</field>
<field name="mode">primary</field>
<field eval="7" name="priority"/>
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='categ_id']" position="after">
<field name="get_loc_user" />
</xpath>
<xpath expr="//field[@name='asset_ids']" position="after">
<field name="get_parts_locations_rel_ids">
<tree string="Locations" >
<field name="loc_case"/>
<field name="loc_row" />
<field name="loc_rack" />
<field name="location_id" />
</tree >
</field>
</xpath>
</field>
</record>
我希望 one2many 字段 get_parts_locations_rel_ids 中的结果是根据 get_loc_user 字段按字段 location_id 过滤,但我不知道该怎么做
【问题讨论】: