Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
5371 มุมมอง

Hello,
I'm having a issue with Lots/Serial Numbers in odoo 11 , i have third part module & was wroking fine 

but now when i wanna create new  Lots/Serial Numberi get this err :

Traceback (most recent call last):
File "/opt/odoo/odoo/http.py", line 653, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/opt/odoo/odoo/http.py", line 312, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/opt/odoo/odoo/tools/pycompat.py", line 87, in reraise
raise value
File "/opt/odoo/odoo/http.py", line 695, in dispatch
result = self._call_function(**self.params)
File "/opt/odoo/odoo/http.py", line 344, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/opt/odoo/odoo/service/model.py", line 97, in wrapper
return f(dbname, *args, **kwargs)
File "/opt/odoo/odoo/http.py", line 337, in checked_call
result = self.endpoint(*a, **kw)
File "/opt/odoo/odoo/http.py", line 939, in __call__
return self.method(*args, **kw)
File "/opt/odoo/odoo/http.py", line 517, in response_wrap
response = f(*args, **kw)
File "/opt/odoo/addons/web/controllers/main.py", line 935, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/opt/odoo/addons/web/controllers/main.py", line 927, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/opt/odoo/odoo/api.py", line 697, in call_kw
return call_kw_model(method, model, args, kwargs)
File "/opt/odoo/odoo/api.py", line 682, in call_kw_model
result = method(recs, *args, **kwargs)
File "/opt/berger_addons/serial_unique_warning/models/stock_production_lot.py", line 75, in create
partner.write({'category_id': [( 4,tag_id.id)]})
File "/opt/odoo/odoo/fields.py", line 2590, in __get__
raise ValueError("Expected singleton: %s" % record)
ValueError: Expected singleton: res.partner.category(36, 59)

I have no idea how to solve this. Can anyone help ? Thanks in advance

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,

You are getting singleton error when the self containing more than one record, in such cases you have to iterate the self/object over a for loop.

See the example:   https://www.youtube.com/watch?v=Rv44nFVn_5U&list=PLqRRLx0cl0homY1elJbSoWfeQbRKJ-oPO&index=30

Thanks

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Dear Tensai,

While using the module if it's one category working fine but in your error log says res.partner.category(36, 59) having two records to avoid this error you need to loop res.partner.category.

Thank you

อวตาร
ละทิ้ง
ผู้เขียน

Hi Ajin ,

Thanks for your reply

can you explain more how to loop res.partner.category ?

Related Posts ตอบกลับ มุมมอง กิจกรรม
Can I process quality checks per lot? แก้ไขแล้ว
1
ก.ค. 24
1474
2
ส.ค. 25
562
2
ก.ค. 24
2699
2
ก.ค. 24
2006
1
มิ.ย. 24
5158