我在模型中有两个字段:«categorie»和«item»,每个类别可以有很多类似enter image description here的项目:
class class4(models.Model):
_name = 'module.categorieitems'
name = fields.Many2one('module.categorie', string='Categorie')
items = fields.Many2many('module.item', string='Items')
class class5(models.Model):
_inherit = 'sale.order.line'
categorie = fields.Many2one('module.categorie')
item = fields.Char() # Here i need Many2one('categorie.item
如何从与类别相关的项目中选择字段项目(字段many2one),这是xml文件:
<record id="sale_order_line_form_inherited" model="ir.ui.view">
<field name="name">sale_order.line.form.inherited</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="//tree//field[@name='name']" position="after">
<field name="categorie"/>
<field name="item"/>
</xpath>
</field>
这是观看enter image description here的场景