Skip to Content
Menu
This question has been flagged
7400 Views

here is my code that works fine with flask app but when I try to do it in odoo I get this error:

Error:
Odoo Server Error

Traceback (most recent call last):
  File "/opt/odoo/odoo11/odoo/http.py", line 651, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/opt/odoo/odoo11/odoo/http.py", line 310, in _handle_exception
    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
  File "/opt/odoo/odoo11/odoo/tools/pycompat.py", line 87, in reraise
    raise value
  File "/opt/odoo/odoo11/odoo/http.py", line 693, in dispatch
    result = self._call_function(**self.params)
  File "/opt/odoo/odoo11/odoo/http.py", line 342, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/opt/odoo/odoo11/odoo/service/model.py", line 97, in wrapper
    return f(dbname, *args, **kwargs)
  File "/opt/odoo/odoo11/odoo/http.py", line 335, in checked_call
    result = self.endpoint(*a, **kw)
  File "/opt/odoo/odoo11/odoo/http.py", line 937, in __call__
    return self.method(*args, **kw)
  File "/opt/odoo/odoo11/odoo/http.py", line 515, in response_wrap
    response = f(*args, **kw)
  File "/opt/odoo/odoo11/addons/web/controllers/main.py", line 938, in call_button
    action = self._call_kw(model, method, args, {})
  File "/opt/odoo/odoo11/addons/web/controllers/main.py", line 926, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/opt/odoo/odoo11/odoo/api.py", line 689, in call_kw
    return call_kw_multi(method, model, args, kwargs)
  File "/opt/odoo/odoo11/odoo/api.py", line 680, in call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/opt/odoo/odoo11/odoo11-custom-addons/converter/models/models.py", line 304, in converter
    start(_fichierZip, _rigname, _field, _country, _wellname, _wellsection, _wits)
  File "/opt/odoo/odoo11/odoo11-custom-addons/converter/models/models.py", line 274, in start
    header = pp.apply(addHeader, args=(RigName, field, country, WellName, WellSection, wits))
  File "/usr/lib/python3.6/multiprocessing/pool.py", line 281, in apply
    return self.apply_async(func, args, kwds).get()
  File "/usr/lib/python3.6/multiprocessing/pool.py", line 670, in get
    raise self._value
  File "/usr/lib/python3.6/multiprocessing/pool.py", line 450, in _handle_tasks
    put(task)
  File "/usr/lib/python3.6/multiprocessing/connection.py", line 206, in send
    self._send_bytes(_ForkingPickler.dumps(obj))
  File "/usr/lib/python3.6/multiprocessing/reduction.py", line 51, in dumps
    cls(buf, protocol).dump(obj)


AttributeError: Can't pickle local object 'converter.converter.<locals>.addHeader'


my code:

def addHeader(/*my arguments goes here*/):

       # code goes here

 def start(/*my arguments goes here*/):

        #code goes here

        pp=multiprocessing.Pool(1)

        header= pp.apply(addHeader, args=(/*arguments goes here*/))

       #code goes here


any indication concerning this error 

          



Avatar
Discard
Related Posts Replies Views Activity
2
Jul 22
7401
1
Jun 21
1057
2
Feb 21
299
5
Sep 20
12739
4
Jun 20
48214