Skip to Content
Menu
This question has been flagged
2 Replies
4258 Views

This is my code

def llogarit_piket_nga_rezultatet(self):
ndeshje = self.env["ndeshje"].search(
['&'("ekipi_home_id", "=", self.ekipit_id.id), ('ekipi_away_id', '=', self.ekipit_id.id)])
for nd in ndeshje:
if nd.ekipi_home_id:
if nd.gola_home > nd.gola_away:
self.fitore += 1
elif nd.gola_home == nd.gola_away:
self.barazime += 1
else:
self.humbje += 1
else:
if nd.gola_home < nd.gola_away:
self.fitore += 1
elif nd.gola_home == nd.gola_away:
self.barazime += 1
else:
self.humbje += 1


This is the full error

Traceback (most recent call last):
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\http.py", line 653, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\http.py", line 312, in _handle_exception
    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\tools\pycompat.py", line 87, in reraise
    raise value
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\http.py", line 695, in dispatch
    result = self._call_function(**self.params)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\http.py", line 344, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\service\model.py", line 97, in wrapper
    return f(dbname, *args, **kwargs)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\http.py", line 337, in checked_call
    result = self.endpoint(*a, **kw)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\http.py", line 939, in __call__
    return self.method(*args, **kw)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\http.py", line 517, in response_wrap
    response = f(*args, **kw)
  File "c:\program files (x86)\odoo 11.0\server\odoo\addons\web\controllers\main.py", line 938, in call_button
    action = self._call_kw(model, method, args, {})
  File "c:\program files (x86)\odoo 11.0\server\odoo\addons\web\controllers\main.py", line 926, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\api.py", line 699, in call_kw
    return call_kw_multi(method, model, args, kwargs)
  File "C:\Program Files (x86)\Odoo 11.0\server\odoo\api.py", line 690, in call_kw_multi
    result = method(recs, *args, **kwargs)
  File "c:\program files (x86)\odoo 11.0\server\odoo\addons\football\models\futboll.py", line 58, in llogarit_piket_nga_rezultatet
    ['&'("ekipi_home_id", "=", self.ekipit_id.id), ('ekipi_away_id', '=', self.ekipit_id.id)])
TypeError: 'str' object is not callable


Avatar
Discard
Best Answer

Calling a string object will cause this error,

if its not a relational field (Many2one , One2many or Many2many) remove '. id ' 


 




Avatar
Discard
Best Answer

please make sure the field self.ekipit_id is a relational object. The system got the error when you are accessing a child filed from a string.

Avatar
Discard
Related Posts Replies Views Activity
2
Mar 22
4270
2
Dec 19
2571
2
Jul 24
939
1
Jun 24
3560
1
Oct 23
8578