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

Make Sale_Order_Line Field Readonly From Custom Module

By
omkar
on 5/26/14, 7:02 AM 561 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

Dhinesh - Technical Consultant, Sodexis Inc

--Dhinesh - Technical Consultant, Sodexis Inc--
3577
| 5 4 9
Pondicherry, India
--Dhinesh - Technical Consultant, Sodexis Inc--

Passionate coder in Python/OpenERP. Knows Django/Flask MVC frameworks. Did code in Java, PHP.

Contact me at: dvdhinesh.mail@gmail.com

Dhinesh - Technical Consultant, Sodexis Inc
On 5/26/14, 8:06 AM

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

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