Odoo Help


How can I get my custom order_line fields to show as readonly like the rest?

Kit Sunde
on 9/10/14, 5:35 PM 587 views

Currently when I edit a confirmed order my fiels are non-editable but have a white background as opposed to the grey one of the other items. Like this: https://www.dropbox.com/s/bp5qs6et257iczc/Screenshot 2014-09-11 05.33.07.png?dl=0 My model:

class sales_order_line_item_email(osv.Model):
    _name = 'sale.order.line'
    _inherit = 'sale.order.line'
    _columns = {
        'email_chain': fields.many2one(
            'Email Chain',
        'starting_day': fields.date('Starting Day', required=False),

I tried imitating the sale order XML with:

<record id="view_order_line_form2_inherit" model="ir.ui.view">
  <field name="name">sale.order.line.form2.inherit</field>
  <field name="model">sale.order.line</field>
  <field name="inherit_id" ref="sale.view_order_line_form2"/>
  <field name="arch" type="xml">
    <field name="price_subtotal" position="before">
      <field name="starting_day" readonly="1"/>
      <field name="email_chain" readonly="1"/>

But it doesn't seem the be the correct place to be overriding. Any suggestions?

Michael St-Georges
On 9/10/14, 10:19 PM

I believe this is the intended behavior. I haven't tested, but from observation that seems to be right. Fields that will be editable once the sale.order.line is editable should be grey and field that will never be editable are white. You might want to look at what CSS classes are applied to your fields using a web debugger such as the built-in from Chrome.

So the fields aren't editable, they just visually look like it. I'm trying to figure out how to make them display the same way.

Kit Sunde
on 9/11/14, 3:08 AM

What if you remove the readonly="1".

Michael St-Georges
on 9/11/14, 7:31 AM

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.


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)


Asked: 9/10/14, 5:35 PM
Seen: 587 times
Last updated: 3/16/15, 8:10 AM