Odoo Help


fnct_search in functional fields

Ajeng Shilvie
on 12/29/14, 4:54 AM 655 views

I am trying to implement a custom method on a field to get user groups id using the following code. However there's nothing happend.

class wtc_approval_line(osv.osv):

    def _get_groups(self, cr, uid, ids, field_name, args, context=None):
        x = self.pool.get("res.users").browse(cr, uid, uid)['groups_id']
        #is self.group_id in x ?
        return self.group_id in x
    def _cek_groups(self, cr, uid, obj, name, args, context=None):
        res = []
        x = self.pool.get("res.users").browse(cr, uid, uid)['groups_id']
        ids = obj.search(cr,uid,[]) # ids of visits
        for v in self.browse(cr, uid, ids): # foreach visit
            if all(v.group_id == y[0] for y in x) :
        return [('id','in',res)]



                 'abc':fields.function(_get_groups, string="ABC", type="boolean", fnct_search=_cek_groups)



xml code shown below :

        <record model="ir.actions.act_window" id="approval_portal_action">
            <field name="name">Portal Approval Matrix Biaya</field>
            <field name="res_model">wtc.approval.line</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree</field>
            <field name="domain">[('sts','=','1'),('abc','=',True)]</field>

any idea ?

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: 12/29/14, 4:54 AM
Seen: 655 times
Last updated: 3/16/15, 8:10 AM