Skip to Content
Menu
This question has been flagged
2 Replies
5127 Views

I need to display the records in one2many field from view instead of table, so for that i have created one view and use this view as like table in one2many field.

Eg:

        purchase_details = fields.One2many('purchase.history', 'product_id',

                                       string="Purchase Details")

         View: purchase.history

        But it display the empty one2many field. Can anyone help me.

Avatar
Discard

@Silvia, If you are not performing any operation on your history than ofcouse it will be empty. You need create record in that table based on some action of you main table. in your case if you main table product.template/product.product. you can override create or write method of that model and create records in your history table.

Best Answer

 Can you take "purchase.history" many2one field ?   That relation is compulsory. If you take relation then Following view for add "purchase_details" field:-


    <field name="purchase_details" > 
        <tree>
            <field name="field_name"/>
            <field name="field_name"/>
            <field name="field_name"/>
        </tree>
    </field>
Avatar
Discard
Related Posts Replies Views Activity
2
Sep 22
7895
2
Apr 22
2460
0
Jul 21
5324
1
Mar 21
3342
5
Aug 20
16301