Ir al contenido
Menú
Se marcó esta pregunta
2851 Vistas

Hi forum!

overtime_w = fields.Float(compute='_compute_t_overtime_w')
overtime_w_edit = fields.Float()

The 'overtime_w' compute method:

@api.multi
def _compute_t_overtime_w(self):
self.overtime_w = sum((self.attendance_ids.mapped('overtime_50_numeric'))) / 100

i have 2 fields, i want to set the default value of the 'overtime_w_edit' field to be the value of the 'overtime_w' field, but i can't achieve that.

i want to do this because the '' _compute_t_overtime_w '' field is not editable, so the default value for the 'overtime_w_edit' field should be the value for the 'overtime_w' field. And so until the '' overtime_w_edit '' field was edited, the value of 'overtime_w' would appear, and once edited, the value for which it was edited would appear.

I don't want to use a related field.

I try this way,but is does not work:

overtime_w_edit = fields.Float(default=lambda self: self.overtime_w )

How can i achive this?


Thank your for your help!

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
1
may 22
3818
1
ago 19
3762
3
sept 24
1286
0
dic 23
1250
1
dic 21
6276