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.

2

'State' field in Sales Order Line

By
Pravitha
on 12/30/13, 5:00 AM 2,476 views

Hi,

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

0

Prakash

--Prakash--
3173
| 5 4 7
Bikaner, India
--Prakash--

OpenERP Devloper at SunARC Technology

Prakash
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.

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

0 follower(s)

Stats

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