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:
- إدارة علاقات العملاء
- e-Commerce
- المحاسبة
- المخزون
- PoS
- المشروع
- MRP
لقد تم الإبلاغ عن هذا السؤال
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"
هل أعجبك النقاش؟ لا تكن مستمعاً فقط. شاركنا!
أنشئ حساباً اليوم لتستمتع بالخصائص الحصرية، وتفاعل مع مجتمعنا الرائع!
تسجيل