تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2842 أدوات العرض

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!

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
1
مايو 22
3803
1
أغسطس 19
3752
3
سبتمبر 24
1275
0
ديسمبر 23
1244
1
ديسمبر 21
6267