← Back to team overview

openerp-dev-web team mailing list archive

[Merge] lp:~openerp-dev/openobject-client-web/trunk-bug-753344-jra into lp:openobject-client-web

 

Jiten (OpenERP) has proposed merging lp:~openerp-dev/openobject-client-web/trunk-bug-753344-jra into lp:openobject-client-web.

Requested reviews:
  OpenERP SA's Web Client R&D (openerp-dev-web)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-client-web/trunk-bug-753344-jra/+merge/58956

For M2M in action When domain with string value instead of Ids then it will be allow to create new record and allow to switch view (form to tree) without saving record.

Domain like,
<field name="domain">[('category_id','=','Supplier')]</field>

-- 
https://code.launchpad.net/~openerp-dev/openobject-client-web/trunk-bug-753344-jra/+merge/58956
Your team OpenERP SA's Web Client R&D is requested to review the proposed merge of lp:~openerp-dev/openobject-client-web/trunk-bug-753344-jra into lp:openobject-client-web.
=== modified file 'addons/openerp/widgets/form/_m2m.py'
--- addons/openerp/widgets/form/_m2m.py	2011-02-10 16:09:23 +0000
+++ addons/openerp/widgets/form/_m2m.py	2011-04-25 13:14:29 +0000
@@ -85,6 +85,13 @@
         if ids is None:
             ids = attrs.get('value', [])
 
+        if ids and isinstance(ids[0], (str, unicode)):
+            rpc2 = rpc.RPCProxy(self.relation)
+            result = []
+            for val in ids:
+                result += rpc2.name_search(val, [], '=', rpc.session.context)
+            ids = map(lambda x:x[0], result)
+
         id = (ids or None) and ids[0]
         
         pprefix = ''
@@ -167,6 +174,13 @@
 
     def set_value(self, value):
 
+        if value and isinstance(value[0], (str, unicode)):
+            rpc2 = rpc.RPCProxy(self.relation)
+            result = []
+            for val in value:
+                result += rpc2.name_search(val, [], '=', rpc.session.context)
+            value = map(lambda x:x[0], result)
+
         ids = value
         if isinstance(ids, basestring):
             if not ids.startswith('['):


Follow ups