Odoo Help


ValueError("Expected singleton: %s" % self)

on 7/13/16, 10:44 AM 7,522 views


I'm having so much issues with this code now. Here is my function :

def get_available_view_value(self):

    print ("I am inside method")


         if self.unavailable: (line 89)

         print ("False commence")


         Print ("False value")



         print ("True Value")

         except Exception as e:

         print ("exception raised")

         error_message = _('Exception in getting available view value. Error Message is: ')+e.message

         _logger.exception(error_message+' error is %s ',e)

Here are my logs :

I am inside method

exception raised

2016-07-13 14:39:54,245 11135 ERROR odoo openerp.addons.wms_stock.models.stock_location: Exception in getting available view value. Error Message is: error is ('ValueError', 'Expected singleton: stock.location(17, 19)')

Traceback (most recent call last):

File "/home/xyz/git/odoo-210/odoo/staples-addons/wms_stock/models/stock_location.py", line 89, in get_available_view_value

if self.unavailable:

File "/home/xyz/git/odoo-210/odoo/openerp/fields.py", line 825, in __get__


File "/home/xyz/git/odoo-210/odoo/openerp/models.py", line 5307, in ensure_one

raise except_orm("ValueError", "Expected singleton: %s" % self)

except_orm: ('ValueError', 'Expected singleton: stock.location(17, 19)')

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

On 7/14/16, 4:54 PM

Hey guys, I found the answer myself. we can either do this by replacing self with record or we can use decorator @api.one. worked for me. Thanks :)


Grover Menacho

--Grover Menacho--
| 5 7 8
La Paz, Bolivia
--Grover Menacho--

Odoo Developer

Grover Menacho
On 7/13/16, 3:58 PM

Your variable self is not a singleton, it has two. You have to do:

for location in self:
    if location.unavailable:

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 7/13/16, 10:44 AM
Seen: 7522 times
Last updated: 7/14/16, 4:54 PM