Somesh Khare has proposed merging 
lp:~openerp-dev/openobject-server/6.0-opw-17622-skh into 
lp:openobject-server/6.0.

Requested reviews:
  Raphael Collet (OpenERP) (rco-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-server/6.0-opw-17622-skh/+merge/76408

Hello Raphaƫl,

[IMP] : There is required some improvement for the def exist() method in the 
orm.template and orm.memory.

use case using browse_record on _osv.osv_memory_:

when calling "exist()" method from a browse_record instance. 

It will raise : TypeError: unhashable type: 'list'

Where the type of ids = list

Thanks,
SKH

-- 
https://code.launchpad.net/~openerp-dev/openobject-server/6.0-opw-17622-skh/+merge/76408
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-server/6.0-opw-17622-skh.
=== modified file 'bin/osv/orm.py'
--- bin/osv/orm.py	2011-09-07 06:31:13 +0000
+++ bin/osv/orm.py	2011-09-21 13:28:26 +0000
@@ -1814,7 +1814,7 @@
     def copy(self, cr, uid, id, default=None, context=None):
         raise NotImplementedError(_('The copy method is not implemented on this object !'))
 
-    def exists(self, cr, uid, id, context=None):
+    def exists(self, cr, uid, ids, context=None):
         raise NotImplementedError(_('The exists method is not implemented on this object !'))
 
     def read_string(self, cr, uid, id, langs, fields=None, context=None):
@@ -2112,8 +2112,10 @@
         # nothing to check in memory...
         pass
 
-    def exists(self, cr, uid, id, context=None):
-        return id in self.datas
+    def exists(self, cr, uid, ids, context=None):
+        if isinstance(ids, (int,long)):
+            ids = [ids]
+        return all(( id in self.datas for id in ids ))
 
 class orm(orm_template):
     _sql_constraints = []

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to