Technical mailing list archives


Re: Error expected singleton

Musinguzi Christian
- 01/25/2018 02:42:10

Thanks guys fixed this. Was in the referencing model.

On Jan 25, 2018 05:15, "Ahmed Magdy" <> wrote:
Can you provide the log above this error?
starting from the line above line that contains something like "POST /web/dataset/call_kw/{{ Model name }}/onchange"
and ending with some http 500 status code after the traceback, kindly include the traceback


On Wed, 24 Jan 2018 at 16:45 Musinguzi Christian <> wrote:
Yes I need search to return more than 1 value. A list of records under the equipment model but filtered by the resource.

On Wed, Jan 24, 2018 at 5:30 PM, Aksana Ivanova <> wrote:

I was right

Open equipment resourse id 2 and 4

They will be the same or similar

Your search return 2 values instead of one


Enviado do Correio para Windows 10


De: Musinguzi Christian <>
Enviado: Wednesday, January 24, 2018 2:25:23 PM
Para: Technical
Assunto: Re: Error expected singleton
Thats the error I get

File "/usr/lib/python2.7/dist-packa
ges/odoo/", line 1596, in name_search return self._name_search(name, args, operator, limit=limit) File "/usr/lib/python2.7/dist-packages/odoo/", line 1611, in _name_search return recs.sudo(access_rights_uid).name_get() File "/home/webcode/shares/mymodules/oehealth/oeh_medical/", line 48, in name_get name = File "/usr/lib/python2.7/dist-packages/odoo/", line 904, in __get__ record.ensure_one() File "/usr/lib/python2.7/dist-packages/odoo/", line 4820, in ensure_one raise ValueError("Expected singleton: %s" % self) ValueError: Expected singleton: equipment.resource(2, 4)

--> --> --> --> --> --> -->
Thats the error
On Wed, Jan 24, 2018 at 5:03 PM, Musinguzi Christian <> wrote:
Hi Guys,

I have tried everyones code here and nothing seems to work. Still get the same singleton error.

@Maysam, yes the definition is correct.

The code only works if affected field i.e 'equipment_id' has only one record.
On Wed, Jan 24, 2018 at 4:15 PM, Maysam Al-Haddan <> wrote:

Do you have the right definition of the Class :
from odoo import api, fields, models

class MyClassName(models.Model):
On Wed, Jan 24, 2018 at 11:55 AM, Musinguzi Christian <> wrote:
Hi Community,

I have a small issue, Hope you anyone help.

 I have written a simple model that is responsible to pick specific records depending on change of another. all fields are Many2one. am getting ' Error expected singleton '. however it works when the affected field has only one record.

class CallModel(Model.model)
    _name =
    resource_id = fields.Many2one('resource.resource', help ='our resources')
    equipment_id = fields.Many2one('equipment.resource', help='resource equipment')

    def _resource_onchange(self):
        res = {}
        for rec in self:
            res['domain']={'equipment_id':[('resource_id', '=',]}
        return res

do you know how i could avoid that error --> -->

Mailing-List: -->
Post to:
Unsubscribe: -->

Mailing-List: -->

Post to:

Post to:

Post to:

Best regards,

Ahmed Magdy 
Python developer
Mob: 00201140529523

Post to: