Odoo Help


'State' field in Sales Order Line

on 12/30/13, 5:00 AM 3,569 views


I had made some customizations in sales order for, and as part of that i have added a state to the state field in the sale.order. The state is test. And by default this state should be set while creating a quotation instead of draft. Since in openerp defalt code most of the fields will be editable in the draft state in sale.order and sale.order.line. I have inherited sale.order fields and added the condition to make fields editable in test state also as follows:

'partner_id': fields.many2one('res.partner', 'Customer', readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)], 'test': [('readonly', False)]}, required=True, change_default=True, select=True, track_visibility='always'),

Thus sale.order fields got editable in my new state. But sale.order.line fields are read-only. So i tried the same thing in sale.order.line.

1) inherited state field and added test state.

2) Inherited other fields and added 'test': [('readonly', False)] condition to it.

But this didn’t work for sale.order.line. the fields are still readonly , the Add An Item button is not seen. How can i do this? I want to add products in my new state , how can i do this?

The below given is the state field definition of sale.order.line:

'state': fields.selection([('cancel', 'Cancelled'),('draft', 'Draft'),('confirmed', 'Confirmed'),('exception', 'Exception'),('done', 'Done')], 'Status', required=True, readonly=True,
            help='* The \'Draft\' status is set when the related sales order in draft status. \
                \n* The \'Confirmed\' status is set when the related sales order is confirmed. \
                \n* The \'Exception\' status is set when the related sales order is set as exception. \
                \n* The \'Done\' status is set when the sales order line has been picked. \
                \n* The \'Cancelled\' status is set when a user cancel the sales order related.'),

In the help of state is written The 'Draft' status is set when the related sales order in draft status. .

How is this achieved?How is the state in sale.order.line related to sale.order state field




| 5 4 7
Bikaner, India

OpenERP Developer at SunARC Technology

On 4/30/15, 5:38 AM

In sale.order.line object new "test" state is added?... Then only in sale.order.line 'test': [('readonly', False)] statement will work.

 sale.order.line state will update (using workflow or object method)  based on sale order state. For example If cancel sale order both state in sale order and sale order line updated with cancel using workflow.

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

0 follower(s)


Asked: 12/30/13, 5:00 AM
Seen: 3569 times
Last updated: 4/30/15, 5:49 AM