Odoo Help


How to add custom fields in fields_view_get

on 7/25/14, 11:52 PM 2,013 views

Hi everyone,

i want to add custom field which i had created in ir.model.fields. my field are <field name="x_gh" /> and <field name="x_rrr" />.this code does'nt dispaly field those fields. Here is the code example: Please Help



def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
        result = super(project_requirement, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar, submenu)
        requirement_obj = self.pool.get('project.requirement')
        active_id = context.get('active_id', False)      
        if view_type == 'tree':          
            result['arch'] = '''
            <tree string="Requirement Tree">
                        <field name="parent_requirement_seq" readonly="True"/>
                        <field name="priority" modifiers="{}"/>
                        <field name="responsible" modifiers="{}"/>
                        <field name="x_gh" />

                        <field name="x_rrr" />

        if view_type == 'form':
            result['arch'] = '''
                <form string="Requirement Form" version="8.0">
                        <button name="fields_view_get" String="Fields view get" type="object" class="oe_highlight" />
                        <div class="oe_title">
                                <label for="" string="Requirements " />
                                <field name="priority" widget="select"/>
                                <field name="responsible" widget="select"/>

                                 <field name="x_rrr" />

                                <field name="x_gh" />


        return result


Did you try to add the field in result['fields']?

Sajad KK
on 7/26/14, 12:12 AM

Thanks sajad,,, i got by changing my fuction like this: result['fields'].update({"x_gh": {'string': 'x_GH By', 'type': 'char'}}) Cheers...

on 7/26/14, 1:19 AM
Sajad KK
On 7/26/14, 12:44 AM

Try this,

result['fields'].update({"x_gh": {'string': 'x_GH By', 'type': 'char'}})





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

2 follower(s)


Asked: 7/25/14, 11:52 PM
Seen: 2013 times
Last updated: 3/16/15, 8:10 AM