Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
9895 Widoki

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

Awatar
Odrzuć
Najlepsza odpowiedź

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.

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
2
gru 24
21250
0
wrz 24
1086
3
sie 24
2198
0
lut 24
1516
0
lut 24
1093