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 get my custom order_line fields to show as readonly like the rest?

v8
By
Kit Sunde
on 9/10/14, 5:35 PM 428 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(
            'sale.order_email.collection',
            'Email Chain',
            required=False
        ),
        '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"/>
    </field>
  </field>
</record>

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

0
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

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/10/14, 5:35 PM
Seen: 428 times
Last updated: 3/16/15, 8:10 AM