Odoo Help

0

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

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

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.

Register

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)

Stats

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