Skip to Content
Menu
This question has been flagged
1 Reply
5454 Views

Hi all,

This problem is something special but maybe someone can help.

once we are trying to add a new fields (many to many fields ) it saveing sucssfuly, but this leads this error message appear showomg in command line is disturbing us.

tis error log odoo Server Error

_Impacted versions:_ 10


odoo Server Error

oo10/odoo/odoo/http.py", line 640, in _handle_exception

    return super(JsonRequest, self)._handle_exception(exception)

  File "/opt/odoo10/odoo/odoo/http.py", line 677, in dispatch

    result = self._call_function(**self.params)

  File "/opt/odoo10/odoo/odoo/http.py", line 333, in _call_function

    return checked_call(self.db, *args, **kwargs)

  File "/opt/odoo10/odoo/odoo/service/model.py", line 101, in wrapper

    return f(dbname, *args, **kwargs)

  File "/opt/odoo10/odoo/odoo/http.py", line 326, in checked_call

    result = self.endpoint(*a, **kw)

  File "/opt/odoo10/odoo/odoo/http.py", line 935, in __call__

    return self.method(*args, **kw)

  File "/opt/odoo10/odoo/odoo/http.py", line 506, in response_wrap

    response = f(*args, **kw)

  File "/opt/odoo10/odoo/addons/web/controllers/main.py", line 885, in call_kw

    return self._call_kw(model, method, args, kwargs)

  File "/opt/odoo10/odoo/addons/web/controllers/main.py", line 877, in _call_kw

    return call_kw(request.env[model], method, args, kwargs)

  File "/opt/odoo10/odoo/odoo/api.py", line 681, in call_kw

    return call_kw_multi(method, model, args, kwargs)

  File "/opt/odoo10/odoo/odoo/api.py", line 670, in call_kw_multi

    recs = self.with_context(context or {}).browse(ids)

  File "/opt/odoo10/odoo/odoo/models.py", line 4794, in browse

    return self._browse(ids, self.env, prefetch)

  File "/opt/odoo10/odoo/odoo/models.py", line 4781, in _browse

    prefetch[cls._name].update(ids)

TypeError: unhashable type: 'list'

this is my code

 

class MODEL_B(models.Model):
    _name = 'MODEL.B'
    filde1 = fields.Char('')
    mawd_ids = fields.Many2many('MODEL.A','model1_model2_rel','filde1','field2','mawbids')
_____________________________________________________________________________________________________________________
class MODEL_A(models.Model):
    _name = 'MODEL.A'
 filde2 = fields.Char('')
 def add_hawb(self):
        res = {
            'type': 'ir.actions.act_window',
            'name': ('Create New'),
            'res_model': 'MODEL.A',
            'view_type': 'form',
            'view_mode': 'form',
            'target': 'current',
            'context': {'default_mawd_ids': (4,self.id)}
        }
        return res

Thanks 

Avatar
Discard
Author Best Answer

Small correction for my code :


class MODEL_B(models.Model): 
    _name = 'MODEL.B' 
    filde1 = fields.Char('') 
    mawd_ids = fields.Many2many('MODEL.A','model1_model2_rel','filde1','field2','mawbids') 
_____________________________________________________________________________________________________________________
class MODEL_A(models.Model): 
    _name = 'MODEL.A' 
 filde2 = fields.Char('') 
 def add_hawb(self): 
        res = { 
            'type': 'ir.actions.act_window', 
            'name': ('Create New'), 
            'res_model': 'MODEL.B', 
            'view_type': 'form', 
            'view_mode': 'form', 
            'target': 'current', 
            'context': {'default_mawd_ids': (4,self.id)} 
        } 
        return res


Avatar
Discard
Related Posts Replies Views Activity
4
Mar 15
31680
1
Sep 21
1077
2
Jun 21
3216
2
Mar 15
5858
1
Feb 24
836