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.

4

readonly in view not working?

By
Atchuthan - Technical Consultant, Sodexis Inc
on 4/22/14, 6:32 AM 4,422 views

I tried to use attrs in <page> and <group> as follows:

NOT WORKING

<group attrs="{'readonly':[('state','=','done')]}">
    <field name="field1" />
    <field name="field2" />
    <field name="field3" />
    <field name="field4" />
</group>

but readonly does not work in page and group. instead when tried with invisible, it worked.

So, should I use readonly for field level only or is there any better method?

WORKING

<group>
    <field name="field1"  attrs="{'readonly':[('state','=','done')]}" />
    <field name="field2"  attrs="{'readonly':[('state','=','done')]}"/>
    <field name="field3"  attrs="{'readonly':[('state','=','done')]}"/>
    <field name="field4"  attrs="{'readonly':[('state','=','done')]}"/>
</group>

Have you opened an issue in the odoo tracker ? Because it would be something really practical to have...

Sathors
on 8/27/14, 1:32 PM

Hello Atchuthan, I have the same problem with you. Did you solve it?

yopi
on 7/28/15, 10:48 PM

@yopi, no. I set those 4 fields as read-only and not in group.

Atchuthan - Technical Consultant, Sodexis Inc
on 7/29/15, 1:53 AM

This would be very handy indeed.

Also documentation makes no mention that "Invisible" attribute is working, but not "readonly" and "required".

https://www.odoo.com/documentation/9.0/reference/views.html#structural-components

Mathieu Laflamme
on 9/1/16, 12:17 PM
0
Mathieu Laflamme
On 9/1/16, 12:16 PM

This would be very handy indeed.

Also documentation makes no mention that "Invisible" attribute is working, but not "readonly" and "required".

https://www.odoo.com/documentation/9.0/reference/views.html#structural-components

0

Atul Kumar jain

--Atul Kumar jain--
914
| 5 3 7
Indore, India
--Atul Kumar jain--

.

Atul Kumar jain
On 4/22/14, 10:24 AM

I have used it in my custom module

<page string="Campaign Details">
                    <field name="outdoor" widget="outdoor" attrs="{'invisible':[('type_of_activity','=','paper_media')]}" >
                    <tree string="Out Door Activity" editable="bottom">
                        <field name="sequence_no"/>
                        <field name="product_id"/>
                        <field name="places"/>
                        <field name="duration"/>
                        <field name="width"/>
                        <field name="length"/>
                        <field name="tax_id" widget="many2many_tags" domain="[('parent_id','=',False),('type_tax_use','&lt;&gt;','purchase')]"/>
                        <field name="price"/>
                        <field name="quantity"/>
                        <field name="price_subtotal"/>
                    </tree> 
                    </field>
</page>

yes, I can also use it on a single field.

I am asking how to set readonly for a group or page

Atchuthan - Technical Consultant, Sodexis Inc
on 4/22/14, 10:52 AM

also only invisible works in attrs of group and page

Atchuthan - Technical Consultant, Sodexis Inc
on 4/22/14, 10:54 AM

i think you should have use this for readonly <group string="Data"> <field name="url" widget="url" attrs="{'readonly':[('type','=','binary')]}"/> </group>

Atul Kumar jain
on 4/22/14, 10:58 AM

yes but my question regards to use of attrs="{'readonly':[domain]}" in PAGE and GROUP

Atchuthan - Technical Consultant, Sodexis Inc
on 4/22/14, 11:26 AM
0

Prakash

--Prakash--
3173
| 5 4 7
Bikaner, India
--Prakash--

OpenERP Devloper at SunARC Technology

Prakash
On 4/22/14, 10:19 AM

In Default Openerp Project Module attrs readonly used in the <page> tag:-

addons/project/project_view.xml

<page string="Extra Info" attrs="{'readonly':[('state','=','done')]}">
                            <group col="4">
                                <field name="priority" groups="base.group_user"/>
                                <field name="sequence"/>
                                <field name="partner_id"/>
                                <field name="state" invisible="1"/>
                                <field name="company_id" groups="base.group_multi_company" widget="selection"/>
                            </group>
                            <group>
                                <group string="Gantt View">
                                    <field name="date_start"/>
                                    <field name="date_end"/>
                                </group>
                                <group>
                                </group>
                            </group>
</page>

yes, its available in code. But its not working in project_view

Atchuthan - Technical Consultant, Sodexis Inc
on 4/22/14, 10:23 AM

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

3 follower(s)

Stats

Asked: 4/22/14, 6:32 AM
Seen: 4422 times
Last updated: 9/1/16, 12:16 PM