Odoo Help

0

Make Sale_Order_Line Field Readonly From Custom Module

By
omkar
on 5/26/14, 7:02 AM 815 views

I am working on Sale Orders.

In the Sale Order Lines , there was a field with the features , readonly when state in draft , required=True.

I want to make the field readonly in the draft state also from my custom module.

How can I make the field 

 

Here is the Field in sale.order.line:

        'product_uom_qty': fields.float('Quantity', digits_compute= dp.get_precision('Product UoS'), required=True, readonly=True, states={'draft': [('readonly', False)]})

I want to make the field readonly in the draft state also from my custom module view.

Please help me friends.

2

Hi, Create a custom module and use this code...

class sale_order_line(osv.osv):
    _name = "sale.order.line"
    _inherit = "sale.order.line"
    _columns = {
                'product_uom_qty': fields.float('Quantity', digits_compute= dp.get_precision('Product UoS'), required=True, readonly=True),
    }

Dont forget to import: import openerp.addons.decimal_precision as dp

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: 5/26/14, 7:02 AM
Seen: 815 times
Last updated: 3/16/15, 8:10 AM