Odoo Help


How Can i make (stock_move) "move_lines" readonly when stock_picking state!='draft'

on 9/1/14, 6:14 AM 1,143 views

How Can i make "move_lines" readonly when stock_picking state!='draft' and for the perticular user group

i had tried this but not working

<?xml version="1.0" encoding="utf-8"?>
        <record id="sim_view_picking_form" model="ir.ui.view">
            <field name="name">sim.stock.picking.form</field>
            <field name="model">stock.picking.out</field>
            <field name="inherit_id" ref="stock.view_picking_form"/>
            <field name="arch" type="xml">

               <xpath expr="//notebook/page/field[@name='move_lines']" position="attributes">
                    <attribute name="attrs">{'readonly': [('state','!=','draft')]}</attribute>




Techno-Functional Associate with 7+ years of experience in Odoo (formerly known as OpenERP).

On 9/8/14, 3:44 AM

Write a boolean functional field, which will evaluate based on both states and user group..

Use the resulting value to control your fields in XML views, using attrs property...

Note: remove readonly attributes specified in your python class...

should i write attrs for "move_lines" Field or need to give attrs inside line object.

on 9/8/14, 7:55 AM

odoo.ma by IBS Group

--odoo.ma by IBS Group--
| 4 5 8
Tétouan, Morocco
--odoo.ma by IBS Group--

For more informations about IBS, please visit our website at www.ibs-na.com.

For a specific questions, collaboration or help, please send us an email to support@ibs-na.com

odoo.ma by IBS Group
On 9/1/14, 3:31 PM

Do something like this:

class stock_picking(osv.osv):
    _inherit = "stock.picking"   

    _columns = {

        'move_lines': fields.one2many('stock.move', 'picking_id', 'Internal Moves', readonly = True, states={ 'draft': [ ( 'readonly', False ) ] } ),

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: 9/1/14, 6:14 AM
Seen: 1143 times
Last updated: 3/16/15, 8:10 AM