Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
2868 Vizualizări

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!

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
1
mai 22
3877
1
aug. 19
3798
3
sept. 24
1316
0
dec. 23
1272
1
dec. 21
6304