Skip to Content
Menu
This question has been flagged
1 Reply
2949 Views

I have a problem: I need to manually enter 2 fields' requested_document 'on sale.order and on sale.order.line, I want to enter the value for' 'requested_document' on each line of sale.order.line itself I have related them but the problem is related for not edit, I tried

         def _default_requested_document (self):

             if self.context.get ('active_model') == 'sale.order':

                 return self.context.get ('active_id', False)

         requested_document = fields.Text ('Requested Document', default = _default_requested_document) but failed.

Avatar
Discard
Best Answer

Hi Paul,

i think there is a problem in context getting,

You can get context using:

self.env.context or self._context 

To get context value:

self.env.context.get('active_model') or self._context.get('active_model')

other code are perfect.

Accept and upvote answer if helpful..

Thank you


Avatar
Discard
Related Posts Replies Views Activity
2
Jan 23
1060
1
Aug 22
3120
0
Dec 18
4472
1
Mar 15
4298
1
Feb 23
1004