Odoo Help

Welcome!

This community 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.

0

Attributes of fields on dynamic views v7

By
Petar
on 7/3/13, 1:05 PM 1,092 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.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 7/3/13, 1:05 PM
Seen: 1092 times
Last updated: 3/16/15, 8:10 AM