Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
5299 Visualizzazioni

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

Avatar
Abbandona
Risposta migliore

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

Avatar
Abbandona
Risposta migliore

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

Avatar
Abbandona
Autore

Hi Ajin ,

Thanks for your reply

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

Post correlati Risposte Visualizzazioni Attività
1
lug 24
1407
2
ago 25
397
2
lug 24
2596
2
lug 24
1974
1
giu 24
5058