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

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

By
Narayanamurthy
on 9/1/14, 6:14 AM 779 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"?>
<openerp>
    <data>
        
        <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>
                </xpath>

            </field>
        </record>

    </data>
</openerp>

1

deep

--deep--
1617
| 5 4 7
Bengaluru, India
--deep--

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

deep
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.

Narayanamurthy
on 9/8/14, 7:55 AM
0

IBS

--IBS--
1302
| 4 5 8
Tétouan, Morocco
--IBS--

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

IBS
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)

Stats

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