Odoo Help


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.


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

on 9/1/14, 6:14 AM 766 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>





| 5 4 7
Bangalore, India

Techno-Functional Associate with 6+ 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


| 4 5 8
Tétouan, Morocco

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

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 ) ] } ),

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)


Asked: 9/1/14, 6:14 AM
Seen: 766 times
Last updated: 3/16/15, 8:10 AM