Hiii good people,
is it possible to calculate the value of a float field in the one2many field?
if can please tell me, my current code :
parking_log_ids=fields.One2many('parking_log','parking_log_id',string='Log Parkir')
total_bill_id=fields.Integer(string='Total Tarif', compute='_compute_biaya_total')
@api.multi def _compute_biaya_total(self): self.total_bill_id = len(self.parking_log_ids)
total_rate=fields.Float(string='Total Biaya Parkir')
@api.multi def action_close(self): bill_ = self.rate_id end_time_days = abs(fields.Datetime.from_string(fields.Datetime.now()) - fields.Datetime.from_string(self.start_time)).days end_time_seconds = abs(fields.Datetime.from_string(fields.Datetime.now()) - fields.Datetime.from_string(self.start_time)).seconds end_time_hours = end_time_days * 24.00 + end_time_seconds // 3600.00 amount = bill_ + (end_time_hours - 0.5) * bill_
self.write({'total_rate':amount})
My code currently only counts many fields instead of values that are in the field.
what I want is to calculate the value in o2m(parking_log_ids) that is field 'total_rate' to 'total_bill_id'
I will appreciate all the answers, thank you very much