Odoo Server ErrorTraceback (most recent call last):
File "C:\Users\isgm103.ISGM\Desktop\isgmnm\odoo9\openerp\http.py", line 643, in _handle_exception return super(JsonRequest, self)._handle_exception(exception) File "C:\Users\isgm103.ISGM\Desktop\isgmnm\odoo9\openerp\http.py", line 680, in dispatch result = self._call_function(**self.params) File "C:\Users\isgm103.ISGM\Desktop\isgmnm\odoo9\openerp\http.py", line 316, in _call_function return checked_call(self.db, *args, **kwargs) File "C:\Users\isgm103.ISGM\Desktop\isgmnm\odoo9\openerp\service\model.py", line 118, in wrapper return f(dbname, *args, **kwargs) File "C:\Users\isgm103.ISGM\Desktop\isgmnm\odoo9\openerp\http.py", line 309, in checked_call result = self.endpoint(*a, **kw) File "C:\Users\isgm103.ISGM\Desktop\isgmnm\odoo9\openerp\http.py", line 959, in __call__ return self.method(*args, **kw) File "C:\Users\isgm103.ISGM\Desktop\isgmnm\odoo9\openerp\http.py", line 509, in response_wrap response = f(*args, **kw) File "C:\Users\isgm103.ISGM\Desktop\isgmnm\odoo9\openerp\addons\web\controllers\main.py", line 892, in call_kw return self._call_kw(model, method, args, kwargs) File "C:\Users\isgm103.ISGM\Desktop\isgmnm\odoo9\openerp\addons\web\controllers\main.py", line 884, in _call_kw return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs) File "C:\Users\isgm103.ISGM\Desktop\isgmnm\odoo9\openerp\api.py", line 250, in wrapper return old_api(self, *args, **kwargs) File "C:\Users\isgm103.ISGM\Desktop\isgmnm\odoo9\openerp\api.py", line 381, in old_api result = method(recs, *args, **kwargs) File "C:\Users\isgm103.ISGM\Desktop\isgmnm\odoo9\openerp\models.py", line 6034, in onchange value = record[name] File "C:\Users\isgm103.ISGM\Desktop\isgmnm\odoo9\openerp\models.py", line 5740, in __getitem__ return self._fields[key].__get__(self, type(self)) File "C:\Users\isgm103.ISGM\Desktop\isgmnm\odoo9\openerp\fields.py", line 831, in __get__ self.determine_draft_value(record) File "C:\Users\isgm103.ISGM\Desktop\isgmnm\odoo9\openerp\fields.py", line 944, in determine_draft_value self._compute_value(record) File "C:\Users\isgm103.ISGM\Desktop\isgmnm\odoo9\openerp\fields.py", line 880, in _compute_value getattr(records, self.compute)() File "C:\Users\isgm103.ISGM\Desktop\isgmnm\isgm_erp_extension\models\emp_overtime.py", line 183, in compute_amount
from_dt = datetime.datetime.strptime(self.working_time_in, DATETIME_FORMAT)
TypeError: strptime() argument 1 must be string, not bool
my code
'amount':fields.float('Amount',compute='compute_amount',store=True,readonly=True),
------------------------------------------------------------------------------------------------------------------------------------------
@api.depends('overtime_duration', 'rate') def compute_amount(self):
wage = 0.0
rate = 1.0
total_var = 0.0
print " working time in in compute_amount > " , self.working_time_in
print " working time out in compute_amount > " , self.working_time_out
DATETIME_FORMAT = "%Y-%m-%d %H:%M:%S"
from_dt = datetime.datetime.strptime(self.working_time_in, DATETIME_FORMAT)
print "From_dt",from_dt
to_dt = datetime.datetime.strptime( self.working_time_out, DATETIME_FORMAT)
print "To_dt",to_dt
timedelta = to_dt - from_dt
print "time delta " , timedelta
diff_min = timedelta.days + float(timedelta.seconds) / 60
print "Diff_min",diff_min
self.overtime_duration = diff_min
print " compute_duration end .."
for line in self:
print " for... self line"
if self.overtime_id:
wage = self.overtime_id.rate_per_min
if self.rate == 'first':
rate = 1.0
elif self.rate == 'second':
rate = 1.5
self.amount = wage*self.overtime_duration*rate
total_var += self.amount
print total_var
#
self.overtime_id.total_amount = self.overtime_id.total_amount+self.amount