Post by cydef »

Hello,

We use the 2.0.4 version of Bryntum Gantt.

When we duplicate a task, we have the following error :


RPC_ERROR
Odoo Server Error
Traceback (most recent call last):
File "/var/www/odoo/sources/current/server/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
result = request.dispatch()
File "/var/www/odoo/sources/current/server/odoo/http.py", line 687, in dispatch
result = self._call_function(**self.params)
File "/var/www/odoo/sources/current/server/odoo/http.py", line 359, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/var/www/odoo/sources/current/server/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/var/www/odoo/sources/current/server/odoo/http.py", line 348, in checked_call
result = self.endpoint(*a, **kw)
File "/var/www/odoo/sources/current/server/odoo/http.py", line 916, in call
return self.method(*args, **kw)
File "/var/www/odoo/sources/current/server/odoo/http.py", line 535, in response_wrap
response = f(*args, **kw)
File "/var/www/odoo/sources/current/server/addons/web/controllers/main.py", line 1342, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/var/www/odoo/sources/current/server/addons/web/controllers/main.py", line 1334, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/var/www/odoo/sources/current/server/odoo/api.py", line 464, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "/var/www/odoo/sources/current/smile-addons/smile_data_integration/models/api.py", line 104, in _call_kw_multi
return native_call_kw_multi(method, self, args, kwargs)
File "/var/www/odoo/sources/current/server/odoo/api.py", line 451, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "/var/www/odoo/sources/current/extra/bryntum_gantt/models/project_task.py", line 94, in copy
task_mapping[self.id] = task_copy.id
Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/var/www/odoo/sources/current/server/odoo/http.py", line 643, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/var/www/odoo/sources/current/server/odoo/http.py", line 301, in _handle_exception
raise exception.with_traceback(None) from new_cause
TypeError: 'NoneType' object does not support item assignment

Here is the code from your module :

    @api.returns('self', lambda value: value.id)
    def copy(self, default=None):
        task_copy = super(ProjectTask, self).copy(default)
        task_mapping = self.env.context.get('task_mapping_keys')
        task_mapping[self.id] = task_copy.id
        return task_copy

The 'task_mapping_keys' context does not seem to be initialized when we duplicate a task (it is only done when duplicating whole project).
I added a default value to avoid the error.

task_mapping = self.env.context.get('task_mapping_keys', {})

Could you please fix this in the next version ?
Thank you, and good evening.


Post by Terence »

Thank you for the report, will be fixed in the next release

https://github.com/bryntum/odoo-support/issues/112


Post Reply