Odoo Help


Attributes of fields on dynamic views v7

on 7/3/13, 1:05 PM 1,639 views

Hi everyone,

Either I came across on some interesting "bug" or I'm doing something wrong. Anyhow, here is what I've been trying to accomplish: Create a dynamic view with some readonly fields on it. Here is the code example:

def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
    result = super(automatic_invoice_processor, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar, submenu)
    result['fields'][field_name2] = {
        'domain': [],
        'selectable': True,
        'views' : {},
        'relation' : 'account.invoice',
        'context' : {},
        'type' : 'many2one',
        'readonly': True
    field = '<field name="%s" /> <field name="%s" nolabel="1" readonly="1" />' % (field_name1,field_name2)
    return result

First I tried adding readonly attribute on the view level, then on the actual field definition and then both. Nothing worked :(

Did anyone come across anything similar? Any help would be much appreciated.

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: 7/3/13, 1:05 PM
Seen: 1639 times
Last updated: 3/16/15, 8:10 AM