تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
3987 أدوات العرض

Hello

I have a problem with a create :

self.pool.get('stock.production.lot').create(self._cr,self._uid,{'name': 'X2988','product_id': 2581,'life_date' : '2022-05-31'})


This returns :

Traceback (most recent call last):
File "/odoo/odoo-server/openerp/http.py", line 659, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/odoo/odoo-server/openerp/http.py", line 696, in dispatch
result = self._call_function(**self.params)
File "/odoo/odoo-server/openerp/http.py", line 332, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/odoo/odoo-server/openerp/service/model.py", line 118, in wrapper
return f(dbname, *args, **kwargs)
File "/odoo/odoo-server/openerp/http.py", line 325, in checked_call
result = self.endpoint(*a, **kw)
File "/odoo/odoo-server/openerp/http.py", line 975, in __call__
return self.method(*args, **kw)
File "/odoo/odoo-server/openerp/http.py", line 525, in response_wrap
response = f(*args, **kw)
File "/odoo/odoo-server/addons/web/controllers/main.py", line 897, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/odoo/odoo-server/addons/web/controllers/main.py", line 889, in _call_kw
return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
File "/odoo/odoo-server/openerp/api.py", line 250, in wrapper
return old_api(self, *args, **kwargs)
File "/odoo/odoo-server/openerp/api.py", line 380, in old_api
recs = self.browse(cr, uid, ids, context)
File "/odoo/odoo-server/openerp/api.py", line 250, in wrapper
return old_api(self, *args, **kwargs)
File "/odoo/odoo-server/openerp/models.py", line 5397, in browse
return self._browse(Environment(cr, uid, context or {}), ids)
File "/odoo/odoo-server/openerp/models.py", line 5390, in _browse
env.prefetch[cls._name].update(ids)
TypeError: unhashable type: 'list'

الصورة الرمزية
إهمال
الكاتب أفضل إجابة

Hello, 

Thanks for your reply, but I still have the error showing. However, from the beginning the create is done well, that is to say that the batch is well created. 

Best regards,

Zappone Arthur.


الصورة الرمزية
إهمال
أفضل إجابة

Hi,


Try with the below code and check.

self.pool['stock.production.lot'].create(self._cr,self._uid,{'name': 'X2988','product_id': 2581,'life_date' : '2022-05-31'}, self._context)


Thanks & Regards,

Sunny Sheth

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
2
مارس 15
6795
1
ديسمبر 17
6427
4
سبتمبر 17
5520
1
مارس 15
4927
2
مارس 23
13447