Python 显示res.partner和product.product-OpenERP中的字段

Python 显示res.partner和product.product-OpenERP中的字段,python,xml,openerp,odoo,Python,Xml,Openerp,Odoo,在sale模块中,您得到了对象sale.order和sale.order.line,在sales树视图中,您得到了sale.order对象,以显示该模型中的字段 现在,我试图显示一个字段,例如product_id,它正在销售中。order.line,我知道我可以使用fields.one2many和many21,但它不工作,没有显示任何内容,所以我不知道我在这里做错了什么 我以前在OpenERP上已经做过这种工作,但那是很久以前的事了,我忘记了正确的方法来完成这项工作 下面是我的一段代码有趣的部分

在sale模块中,您得到了对象sale.order和sale.order.line,在sales树视图中,您得到了sale.order对象,以显示该模型中的字段

现在,我试图显示一个字段,例如product_id,它正在销售中。order.line,我知道我可以使用fields.one2many和many21,但它不工作,没有显示任何内容,所以我不知道我在这里做错了什么

我以前在OpenERP上已经做过这种工作,但那是很久以前的事了,我忘记了正确的方法来完成这项工作

下面是我的一段代码有趣的部分

待售

打折

我试图实现的是从sale.order.line继承所有字段,这样我就可以在sale.order树视图中显示其中的任何字段

这是我的xml sale_view.xml

linea_tarifas是相关字段,但它没有显示任何内容

我希望我已经解释清楚了

有什么想法吗


提前谢谢

为此,请查看sale/sale.py和sale/sale_view.xml文件。他们的是one2many是order_line,Many21是order_id,在你的情况下,你有one2many是linea_tarifas,Many21是tarifas,你会清楚地知道你哪里做错了。嗨,我会挖掘它,谢谢!嗯,实际上几乎是一样的,我不知道,也许我应该在我想显示的字段上使用“fields.related”,我想不出来…对于fields.related,你可以参考这个
'linea_tarifas':fields.one2many('sale.order.line', 'tarifas', 'Servicio'),
'tarifas' :fields.many2one('sale.order','Servicio'),
<record id="view_order_tree" model="ir.ui.view">
        <field name="name">sale.order.tree</field>
        <field name="model">sale.order</field>
        <field name="priority">2</field>
        <field name="arch" type="xml">
            <tree string="Sales Orders" fonts="bold:message_unread==True" colors="grey:state=='cancel';blue:state in ('waiting_date','manual');red:state in ('invoice_except','shipping_except')">
                <field name="message_unread" invisible="1"/>
                <field name="name" string="Order Number"/>
                <field name="date_order"/>
                <field name="partner_id" />
                <field name="lider_id"/>
        **<field name="linea_tarifas">**
        **<field name="product_id"/>**
        **</field>**
                <field name="user_id"/>
                <field name="amount_total" sum="Total Tax Included"/>
                <field name="state"/>
            </tree>
        </field>
    </record>

    <record id="view_quotation_tree" model="ir.ui.view">
        <field name="name">sale.order.tree</field>
        <field name="model">sale.order</field>
        <field name="priority">4</field>
        <field name="arch" type="xml">
            <tree string="Servicios" fonts="bold:message_unread==True" colors="grey:state=='cancel';blue:state in ('waiting_date','manual');red:state in ('invoice_except','shipping_except')">
                <field name="message_unread" invisible="1"/>
                <field name="name" string="Numero de Servicio"/>
                <field name="date_order"/>
                <field name="partner_id" />
                <field name="lider_id"/>
        **<field name="linea_tarifas">**
        **<field name="product_id"/>**
        **</field>**
                <field name="user_id"/>
                <field name="amount_total" sum="Total Tax Included"/>
                <field name="state"/>
            </tree>
        </field>
    </record>