Odoo Help


How to Create Function (Dummy) One2many Field in models.Model ?

on 4/16/15, 7:42 AM 973 views

I have create dummy One2many field in osv.osv like this :

def _get_picking_ids(self, cr, uid, ids, field_names, args, context=None):
        res = {}
        for po_id in ids:
            res[po_id] = []
        query = """
        SELECT p.id, po.id FROM stock_picking p, wtc_mutation_order po
            WHERE po.id in %s and p.origin = po.name
            GROUP BY p.id, po.id
        cr.execute(query, (tuple(ids), ))
        picks = cr.fetchall()
        for pick_id, po_id in picks:
        return res

'picking_ids': fields.function(_get_picking_ids, method=True, type='one2many', relation='stock.picking', string='Picking List'),

But how to make it in models.Model ?

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 4/16/15, 7:42 AM
Seen: 973 times
Last updated: 7/10/15, 10:50 AM