ValueError: : "unsupported operand type(s) for -: 'bool' and 'datetime.date'" while evaluating "for record in self:\n record['x_studio_number_of_days'] = record.x_studio_end_date - record.x_studio_start_date\n"How can I fix this
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Akuntansi
- Inventaris
- PoS
- Project
- MRP
Pertanyaan ini telah diberikan tanda
I got it
for record in self:
if record.x_studio_end_date and record.x_studio_start_date:
record['x_studio_number_of_days'] = (record.x_studio_end_date - record.x_studio_start_date).days
Hi,
Seems one of the fields is coming as empty, thus you get this error. In order to overcome the error add if condition and make sure that both the field contains value before subtracting them.
for record in self:
if record.x_studio_end_date and record.x_studio_start_date:
record['x_studio_number_of_days'] = record.x_studio_end_date - record.x_studio_start_date
Thanks
I got error
ValueError: <class 'TypeError'>: "float() argument must be a string or a number, not 'datetime.timedelta'" while evaluating
"for record in self:\n if record.x_studio_end_date and record.x_studio_start_date:\n record['x_studio_number_of_days'] = record.x_studio_end_date - record.x_studio_start_date\n"
Menikmati diskusi? Jangan hanya membaca, ikuti!
Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!
Daftar