コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
3876 ビュー

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.

アバター
破棄
最善の回答

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


アバター
破棄
関連投稿 返信 ビュー 活動
2
1月 23
2425
1
8月 22
5332
0
12月 18
5367
1
3月 15
5001
1
2月 23
1896