Skip to Content
Menu
This question has been flagged

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
Discard
Related Posts Replies Views Activity
1
May 22
2611
1
Aug 19
2871
3
Sep 24
154
0
Dec 23
372
1
Dec 21
5329