Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2870 Zobrazení

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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
kvě 22
3879
1
srp 19
3800
3
zář 24
1316
0
pro 23
1272
1
pro 21
6304