Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
3584 Vistas

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
Descartar
Mejor respuesta

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
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
2
ene 23
1988
1
ago 22
4617
0
dic 18
4982
1
mar 15
4788
1
feb 23
1637