0

On sale module, you got objects sale.order and sale.order.line, On treeview of sales, you got sale.order object, to show fields from that model.

Now, i'm trying to show one field, for example product_id which is on sale.order.line, i know i can use fields.one2many then many2one, but it's not working, not showing anything, so i don't know what i'm doing wrong here.

I did already this kind of job before on OpenERP, but it was long time ago and I jsut forgot the right way to accomplish this...

Here's a piece of my code (interesting part)

on sale.order

'linea_tarifas':fields.one2many('sale.order.line', 'tarifas', 'Servicio'),

On sale.order.line

'tarifas' :fields.many2one('sale.order','Servicio'),

What i'm trying to achieve, is to inherit all fields from sale.order.line so i can show any of them into sale.order tree view.

This is my xml sale_view.xml

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

The linea_tarifas is the related field, but it's not showing anything.

I hope I've explained myself.

Any ideas?

Thanks in advance!

4
  • 2
    for that, please check out sale/sale.py and sale/sale_view.xml file. Their is one2many is order_line and many2one is order_id, in your case you have one2many is linea_tarifas and many2one is tarifas You will get clear idea where you do wrong. Jul 19, 2014 at 8:07
  • Hi, I'll dig it, thanks!
    – NeoVe
    Jul 19, 2014 at 14:04
  • Well, it is actually almost the same, i don't know, maybe i should use 'fields.related' on the fields i want to show, can't figure it out...
    – NeoVe
    Jul 19, 2014 at 19:17
  • 1
    for fields.related, you may refer this stackoverflow.com/questions/23332654/… Jul 20, 2014 at 6:06

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.